Please test the program in C below and evaluate whether it finds the largest and smallest integer among 5 integers the user inputs via the keyboard #include #include int main int abcdemaxmin; printf请
The program provided is incomplete and contains errors. Here is the corrected version:
#include <stdio.h>
int main() {
int a, b, c, d, e, max, min;
printf("请输入五个整数:");
scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
max = a;
min = a;
if (b > max) {
max = b;
}
if (c > max) {
max = c;
}
if (d > max) {
max = d;
}
if (e > max) {
max = e;
}
if (b < min) {
min = b;
}
if (c < min) {
min = c;
}
if (d < min) {
min = d;
}
if (e < min) {
min = e;
}
printf("以上整数中的最大值为:%d,最小值为:%d", max, min);
return 0;
}
This program correctly finds the largest and smallest integers among the five integers inputted by the user
原文地址: https://www.cveoy.top/t/topic/hSLl 著作权归作者所有。请勿转载和采集!