该程序获取 3 个数字并找出其中最大的一个。为此,我们将相互比较数字并找出最大的
input: a=2,b=4,c=7output:7 largest number
说明该程序仅使用 if 语句来查找最大数。
示例#include <iostream>using namespace std;int main() { int a,b,c; a=2,b=4,c=7; if(a>b) { if(a>c) { printf("%d largest number ",a); } else { printf("%d largest number ",c); } } else { if(b>c) { printf("%d largest number ",b); } else { printf("%d largest number ",c); } } return 0;}
以上就是c程序:找出三个数中的最大数的详细内容。