Comparing 3 nos
Hi all... Below is my code of comparing 3 numbers.. I have to check all 4 possibilites in "single code" 1)tell largest no 2) tell you entered equal nos 3)tell smallest number 4)show equality of numbers if any two numbers have same value... First two possibilities are achieved but confused about 3 and 4 Kindly guide me... /////////////////////////////////////////// #include <iostream> using namespace std; int main() { int n1,n2,n3; cout<<"enter three values\n"; cin>>n1>>n2>>n3; if ((n1==n2) && (n2==n3)) cout <<"all numbers are equal\n"<< n1<<" "<<n2 <<" "<< n3; else if((n1>=n2) && (n1>=n3)) { cout<<" largest no \n"<<n1; } else if((n2>=n1) && (n2>=n3)) { cout<<"largest no\n"<<n2; } else { cout<<"largest no"<<" "<<n3; } return 0; }