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 in C
- Discussions
Functions in C
Functions in C
Sort by
recency
|
850 Discussions
|
Please Login in order to post a comment
int max_of_four(int a, int b, int c, int d){ int max_num = a; if (max_num > b) max_num =a ; if (max_num > c) max_num =a ; if (max_num > d) max_num =a ; if(max_num < b) max_num = b; if(max_num < c) max_num = c; if(max_num < d) max_num = 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);
}
It’s a great starting point for anyone serious about computer science or software engineering. betguru247
include
int max(int x, int y){ return (x > y) ? x : y; }
int max_of_four(int a, int b, int c, int d){ return max(max(a, b), max(c, 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);
}
Here is Functions in C problem solution - https://programmingoneonone.com/hackerrank-functions-in-c-problem-solution.html