B.2輸入3個整數,輸出其中的最大值。
阿新 • • 發佈:2019-02-15
任務和程式碼
/* *copyright(c)2017,CSDN學院 *All rights reserved. *檔名稱: main.c *作 者: 楊隆勝 *完成日期: 2017年5月5日 *版 本 號: v1.0 * *問題描述:輸入3個整數,輸出其中的最大值; *輸入描述:輸入三個整數a,b和c; *程式輸出:輸出其中的最大值; */ #include <stdio.h> int main() { int a,b,c,m; printf("Please input the value of three numbers:\n"); scanf("%d %d %d",&a,&b,&c); if(a>b) { m=a; } else { m=b; } if(c>m) { m=c; } printf("The maxmun value of three numbers is:%d\n",m); return 0; }
執行結果
心得體會
感覺好像冒泡法,但是不確定是否是,學的程式設計早就忘了,希望趕緊拾起來。為了夢想,加油!