We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Introduction
- Functions
- Discussions
Functions
Functions
Sort by
recency
|
1991 Discussions
|
Please Login in order to post a comment
int max_of_four(int a, int b, int c, int d){ return ((a>b && a>c && a>d) ? a : ((b>c && b>d)? b : ((c>d)?c :d)) ); }
include
include
using namespace std;
int max_of_four(int x , int y , int z , int s){ int max = 0 ; if (x>max && x> y && x> z && x>s){ max = x; } else if (y > max && y >z && y>s){ max = y;
}
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);
}