We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> int total_max(int IN[], int n) { if (n > 0) { int max = 0; int max_index = 0; int tmp = 0; for (int i = 0; i < n; i++) { if (max < IN[i]) { max = IN[i]; max_index = i; } } tmp = IN[n - 1]; IN[n - 1] = max; IN[max_index] = tmp; if (total_max(IN, n - 1) < max) return max; else return total_max(IN, n - 1); } else { return IN[n]; } } int main(void) { int N = 0; int IN[20] = { 0 }; scanf("%d", &N); for (int i = 0; i < N; i++) { scanf("%d", &IN[i]); } printf("%d", total_max(IN, N)); } // 14011615
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: