Bol som týždeň bez netu, ale tak aspoň si pozrieš ako by to asi malo byť
:
Code:
/**
* @author
* m-> 29
*/
#include <stdlib.h>
#include <stdio.h>
int main(void) {
int N = 0, max;
// načítaj počet čísel
if(scanf("%d", &N) != 1 || N <= 0) {
perror("Chybné číslo!");
return EXIT_FAILURE;
}
// prečítaj 1. číslo
if(scanf("%d", &max) != 1) {
perror("Chybné číslo");
return EXIT_FAILURE;
}
int num;
for(int i=1; i<N; ++i) {
if(scanf("%d", &num) != 1) {
perror("Chybné číslo");
return EXIT_FAILURE;
}
if(num > max) { max = num; }
}
return EXIT_SUCCESS;
}