C++ program to find the maximum number between 2 numbers - It Guru Tz

Breaking News

C++ program to find the maximum number between 2 numbers

This is the simple C++ Programming for the beginners To find the maximum number between two numbers by using If else statement.


/*C++ program to find the maximum number between 2 numbers
I will use IF STATEMENT */
/*STRUCTURE FOR THE IF ELSE STATEMENT
***********************
if(Condition){
#statement
}
else{
#statement 2
}
***********************
*/
#include <iostream>
using namespace std;
int main()
{ //declaration of the variable
int number1;
int number2;
//Give the instruction to the user what to do!!
cout<<"Enter the First number ";
cin >>number1;
cout<<"Enter the Second number ";
cin >>number2;
cout<<endl;
//using of If else statement
if(number1>number2){
cout<<"The number "<<number1<<" is greater than number "<<number2<<endl;
}
else{
cout<<"The number "<<number2<<" is greater than number "<<number1<<endl;
}
return 0;
}