我是怎么想的,我前面学过两个数比大小,比如有三个数,a b c,先比较a和b的大小,然后用那个较大的和c比较就得出最大的那个了。这个求三个数比大小的问题最后变化成 了两个数比大小了。
int main()
{int a = 0;int b = 0;int c = 0;int max2 = 0;//保存两个数中较大的那一个int max3 = 0;//保存三个数中最大的那一个scanf_s("%d %d %d",&a,&b,&c);//先找出a b中较大的那一个if (a > b){max2 = a;if (max2 > c){printf("%d is the greatest",max2);}else{printf("%d is the greatest",c);}}else{max2 = b;if (max2 > c){printf("%d is the greatest",max2);}else{printf("%d is the greatest",c);}}}