用c语言写一个输入abc三个数输出最大着
下面是使用C语言编写的程序,可以输入3个数并输出最大值:
#include <stdio.h>
int main() {
int a, b, c;
printf("请输入三个整数:\n");
scanf("%d %d %d", &a, &b, &c);
int max = a;
if (b > max) {
max = b;
}
if (c > max) {
max = c;
}
printf("最大值是:%d\n", max);
return 0;
}
运行程序后,会提示用户输入三个整数,然后进行比较,找出最大值并输出。
原文地址: https://www.cveoy.top/t/topic/biFg 著作权归作者所有。请勿转载和采集!