about-text

SoftOSet is the most remarkable programming site. SoftOSet provides the fresh conceptual and professional programs, articles, books, and other interesting and technical writings. SoftOSet is the most reliable programming site to learn the programs and the basics of the popular programming languages. SoftOSet is the hub of the informative and research based articles.

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

 

 

 

 

C++ Program of If else statement to find two numbers are smaller, greater or equal

 

 

Hence program has accurately achieved his goal.

 

Thanks for visiting https://www.softoset.blogspot.com


Post a Comment

Feel Free to Comment Us

Previous Post Next Post

Recents