Header Ads Widget

Write a CPP program to find greater between three numbers

 Code:-

#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter three numbers\n";
cin>>a>>b>>c;
if(a>b)
{
if(a>c)
cout<<a<<" is greater number";
else
cout<<c<<" is greater number";
}
else
{
if(b>c)
cout<<b<<" is greater number";
else
cout<<c<<" is greater number";
}
return 0;
}

Output:-

Enter three numbers
5 15 2
15 is greater number




Post a Comment

0 Comments