Объяснение:
#include <stdio.h>
int main(){
int n = 0, min = 0, max = 0, cur = 0;
scanf("%d", &n); // кол-во чисел
if (n > 0) {
scanf("%d", &cur);
min = max = cur;
for (int i = 1; i < n; i ++){
if (cur < min) min = cur;
else if (cur > max) max = cur;
}
printf("Minimum is %d\nMaximum is %d", min, max);
else printf("n must be more than 0");
Объяснение:
#include <stdio.h>
int main(){
int n = 0, min = 0, max = 0, cur = 0;
scanf("%d", &n); // кол-во чисел
if (n > 0) {
scanf("%d", &cur);
min = max = cur;
for (int i = 1; i < n; i ++){
scanf("%d", &cur);
if (cur < min) min = cur;
else if (cur > max) max = cur;
}
printf("Minimum is %d\nMaximum is %d", min, max);
}
else printf("n must be more than 0");
}