Skip to content

C++ Program to Find Greatest of 2 numbers

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

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!