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(); }
Comments
Leave a comment