Program to find greatest of 2 numbers [c++]

This program will take 2 numbers as input from the user and will display the number which is greater of the 2.

We will be displaying program which is compatible with Dev C++.

You can download dev c++ from here


Program Code:



using namespace std;
int main()
int a,b;
cout<<"Enter the two numbers.\n";
cout<<"The greater of the two number is "<<a;
else if(b>a)
cout<<"The greater of two numbers is "<<b;
else if(a==b)
cout<<"Numbers are equal!";



Greatest of 2 numbers

Leave a Reply

Your email address will not be published.