Social Icons

banner image

find greatest among 4 numbers

#include<iostream>
#include<conio.h>
using namespace std;
int max_of_four(int a,int b, int c,int d)
{
if(a>=b && a>=c && a>=d)
{
return a;
}
else
if(b>=c && b>=d && b>=a)
{
return b;
}
else
if(c>=d && c>=a &&c>=b)
{
return c;
}
else
{
return d;

}
}
int main()
{
int a,b,c,d;
cout<<"\nEnter the Four Value:";
cin>>a>>b>>c>>d;
int ans=max_of_four(a,b,c,d);
cout<<"\nThe max of value is:"<<"\t"<<ans;
}
find greatest among 4 numbers find greatest among 4 numbers Reviewed by Shobhit Goel on September 01, 2015 Rating: 5

No comments:

Airtel Hackaton 2017

Powered by Blogger.