1. 程式人生 > >C語言的第二天-比較大小的小程序

C語言的第二天-比較大小的小程序

語言 tro color es2017 turn logs print col pre

 1 #include <stdio.h>
 2 int main()
 3 {
 4     int a,b,c,max;
 5     printf("請輸入三個數:");
 6     scanf("%d,%d,%d",&a,&b,&c);
 7     max = b;
 8     if (a > b)
 9     {
10         max = a;
11     }
12     if (c > max)
13     {
14         max = c;
15     }
16     printf("最大值是:%d\n
",max); //max不在內存地址中,不用加& 17 return 0; 18 }

看看執行結果

技術分享

註:如果有寫錯的地方,不足的地方,要補充的內容,都可以在下方評論,謝謝!

C語言的第二天-比較大小的小程序