27.7k views
0 votes
write c++programs for the following problem: Let the user enter two numbers and display which is greater. please help!

User Tomfmason
by
6.4k points

1 Answer

3 votes

Program to display greater number:


#include <iostream> // Needed to perform IO operations

#include<conio.h> // header file

using namespace std;


int main() //start of the program

{

int a , b =0; //initialising the two integer variable

cout<< "Enter first number"<<endl;

cin >> a; //user's first number

cout<< "Enter second number"<<endl;

cin >> b; //user's second number

if (a>b) //comparing the two integers input by user

cout<< a << "is greater than" << b; //display the greater number

else

cout<< b << "is greater than" << a;

return 0; // exist

}


User Iamkaan
by
6.2k points