Skip to content

Instantly share code, notes, and snippets.

@Nashtic
Created March 6, 2020 18:59
Show Gist options
  • Save Nashtic/687ce054d2ce877bf24b828a82a69124 to your computer and use it in GitHub Desktop.
Save Nashtic/687ce054d2ce877bf24b828a82a69124 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
max_of_four(int a, int b, int c, int d){
if(a>b && a>c && a>d){
return a;
}
else if(b>a && b>c && b>d){
return b;
}
else if(c>a && c>b && c>d){
return c;
}
else{
return d;
}
}
int main() {
int a, b, c, d;
scanf("%d %d %d %d", &a, &b, &c, &d);
int ans = max_of_four(a, b, c, d);
printf("%d", ans);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment