C
- voluntas
- @ignis_fatuus
- ブン
- @Linda_pp
- 清楚なC++メイドBOT
- @tzik_tack
- 長谷川一輝
- wraith13
- @jj1bdx
- @cpp_akira
- 安藤敏彦
- @srz_zumix
- Siv3D
- takezoh
- まろ
- @okdshin
- @hnokx
- @ishidakei
- @take_cheeze
- TAKEI Yuya
- @mumumu
- I (@wx257osn2)
- Tommy6
- @tyottyoworks
- ___shanon
- わたやん
- @KorekaraSEDB
- @kariya_mitsuru
- @ciniml
- @beam2d
- @grafi_tt
- @nekketsuuu
- LouiS0616
- @volanja
- 大鎌広
- むてら
- ガチKGB
- 三重野賢人
x
15
1
2
/* for using INT_MIN */
3
4
int main(void) {
5
int number=0;
6
int max=INT_MIN; /* initialize max */
7
printf("Enter numbers: ");
8
while(scanf("%d",&number)==1 && number!=-1) { /* check value of number */
9
if(number>max) {
10
max=number;
11
}
12
}
13
printf("The max value is %d \n",max);
14
return 0;
15
}
$ gcc prog.c -Wall -Wextra -std=gnu11
Stdin
-100
-200
-300
-1
Start
Enter numbers: The max value is -100
0
Finish