Terbesar dan terkecil dalam 3 angka CPP
// greatest / smallest among three
#include <iostream>
using namespace std;
int main()
{
int a, b, c, greatest , smallest;
cout<< "Enter three numbers: ";
cin>> a >> b >> c;
if(a>b && a>c)
greatest = a;
else if(b>a && b>c)
greatest = b;
else
greatest = c;
if(a<b && a<c)
smallest = a;
else if(b<a && b<c)
smallest = b;
else
smallest = c;
cout << "Greatest = " << greatest <<endl;
cout << "smallest = " << smallest;
return 0;
}
Sleep deprived