Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Abhayparashar31/6dad720724474203ac6566d5c1d67627 to your computer and use it in GitHub Desktop.
Save Abhayparashar31/6dad720724474203ac6566d5c1d67627 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int max_of_four(int a, int b, int c, int d)
{
int max;
if((a>b) && (a>c) && (a>d))
max = a;
if((b>a) && (b>c) && (b>d))
max = b;
if((c>a) && (c>b) && (c>d))
max = c;
if((d>a) && (d>b) && (d>c))
max = d;
return max;
}
int main()
{
int a, b, c, d;
cin>>a>>b>>c>>d;
int ans = max_of_four(a, b, c, d);
cout<<ans;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment