To find
Number is smaller, greater or equal to second number using if else in C Plus
Plus
This
C++ program will ask the user to enter
the two numbers. User will enter two numbers and the program will decide that
these numbers are equal, which one is greater or smaller than other and display
on the screen.
We
will take the advantage of the if else statement to build our logic.
Simple
if else statements will give us our desired result.
C++ Program
of If else statement to find two numbers are smaller, greater or equal
Code of
Program
#include<iostream>
using
namespace std;
int
main()
{
int a,b;
cout<<"Enter Two
Numbers\n";
cin>>a>>b;
if(a==b)
cout<<a<<"and
"<<b<<"are equal"<<endl;;
if(a<b)
cout<<a<<"Less than
"<<b<<endl;;
if(a>b)
cout<<a<<"Greater
than "<<b<<endl;;
return 0;
}
C++ Program
of If else statement to find two numbers are smaller, greater or equal
Output of
Program
And
here is what this code says at front end
Hence
program has accurately achieved his goal.
Thanks
for visiting https://www.softoset.blogspot.com
Post a Comment
Feel Free to Comment Us