C语言求三个数中的最大值:简单易懂的代码实现
#include <stdio.h>
int main() { int a, b, c, max; printf('请输入三个数:'); scanf('%d %d %d', &a, &b, &c); max = a; // 假设a为最大值 if (b > max) { // 如果b大于假设的最大值,则将b赋值给最大值 max = b; } if (c > max) { // 如果c大于假设的最大值,则将c赋值给最大值 max = c; } printf('三个数中的最大值为:%d', max); return 0; }
原文地址: https://www.cveoy.top/t/topic/oAA8 著作权归作者所有。请勿转载和采集!