menentukan angka tertinggi dan terendah dengan C++
#include <stdio.h>
#include <iostream.h>
int main()
{
int x,y,z;
cout<<"Input x : ";cin>>x;
cout<<"Input y : ";cin>>y;
cout<<"Input z : ";cin>>z;
cout<<"------------------\n";
if (x>y)
{
cout<<"Paling Besar : "<<x<<endl;
}
else if (y>x, y>z)
{
cout<<"Paling Besar : "<<y<<endl;
}
else if (z>x, z>y)
{
cout<<"Paling Besar : "<<z<<endl;
}
if (x<y, x<z)
{
cout<<"Paling Kecil : "<<x<<endl;
}
else if (y<x, y<z)
{
cout<<"Paling Kecil : "<<y<<endl;
}
else if (z<x, z<y)
{
cout<<"Paling Kecil : "<<z<<endl;
}
}
#include <iostream.h>
int main()
{
int x,y,z;
cout<<"Input x : ";cin>>x;
cout<<"Input y : ";cin>>y;
cout<<"Input z : ";cin>>z;
cout<<"------------------\n";
if (x>y)
{
cout<<"Paling Besar : "<<x<<endl;
}
else if (y>x, y>z)
{
cout<<"Paling Besar : "<<y<<endl;
}
else if (z>x, z>y)
{
cout<<"Paling Besar : "<<z<<endl;
}
if (x<y, x<z)
{
cout<<"Paling Kecil : "<<x<<endl;
}
else if (y<x, y<z)
{
cout<<"Paling Kecil : "<<y<<endl;
}
else if (z<x, z<y)
{
cout<<"Paling Kecil : "<<z<<endl;
}
}
Comments
Post a Comment