hy30nq's blog
1286 풀이 본문
728x90
https://codeup.kr/problem.php?id=1286
최댓값, 최솟값
$5$개의 정수가 한 줄에 하나씩 입력된다.(범위 : $-1,000,000$ ~ $1,000,000$)
codeup.kr
답
#include <stdio.h>
int main()
{
int max = -1000000;
int min = 1000000;
int n, i;
for(i = 0; i < 5; i++)
{
scanf("%d", &n);
if(n > max) max = n;
if(n < min) min = n;
}
printf("%d\n%d", max, min);
return 0;
}

728x90