#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;
}
#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
Reviewed by Shobhit Goel
on
September 01, 2015
Rating:
No comments:
Post a Comment