Answer to Question #4838 in C++ for matt

Question #4838
write a program that ask the user to enter two numbers. the program should use the conditional operator to determine which number is the smaller and which is the larger.
1
Expert's answer
2011-10-27T08:18:39-0400

#include <iostream.h>
#include <conio.h>
main(){
int a,b;
cout<<"Enter number a:";
cin>>a;
cout<<"Enter number b:";
cin>>b;
if (a>b) cout<<"a is larger than b";
if (a<b) cout<<"b is larger than a";
if (a==b) cout<<"a is equal b";
getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS