+ 1
Write a program in c++ to display greatest of two input number using IF... ELSE
3 Answers
+ 1
#include <iostream>
using namespace std;
int main() {
int x,y;
cout<<"Enter the two numbers"<<endl;
cin>>x>>y;
if((x-y)>0)
{
cout<<x<<" is greater"<<endl;
}
else
{
cout<<y<<" is greater"<<endl;
}
getch();
return 0;
}
0
#include <iostream>
using namespace std;
int main() {
int x,y;
cout<<"Enter the two numbers"<<endl;
cin>>x>>y;
if(x>y)
{
cout<<x<<" is greater"<<endl;
}
else
{
cout<<y<<" is greater"<<endl;
}
getch();
return 0;
}
0
#include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Enter the two numbers:-";
cin>>a>>b;
if(a>b)
{
Cout<<"a is grater";
}
else
{
cout<<"b is greater";
}
return 0;
}