Wednesday, 10 July 2013


C++ Program to illustrate simple if-else
Finding Greatest of 2 numbers

Code:
/*C++ Program to illustrate simple if-else
Finding Greatest of 2 nos.*/
#include<iostream.h>
#include<conio.h>
int main()
{
 clrscr();
 int a,b;
 cout << " Enter number 1 = " ;
 cin >> a;
 cout << " Enter 2nd number = ";
 cin >> b;
 if (a>b)
 cout << " Number 1 is Greater than Number 2";
 else
 cout <<" Number 2 is Greater than Number 1";
 getch();
 return 0;
}

Sample Output:



Comment bellow for your Query and Feedback

Related Posts :



0 comments:

Confused? Feel free to ask

Post a Comment