100 이하의 두 개의 정수를 입력받아 작은 수부터 큰 수까지 차례대로 출력하는 프로그램을 작성하시오.



 [Copy]
10 5
 [Copy]
5 6 7 8 9 10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
int main() {
    int a, b;
    scanf_s("%d %d"&a, &b);
    if (a > b) {
        while (a >= b) {
            printf("%d ", b);
            b++;
        }
    }
    else if (a <= b) {
        while (a <= b) {
            printf("%d ", a);
            a++;
        }
    }
    return 0;
}
 
 
cs


'c언어' 카테고리의 다른 글

정보 올림피아드 - 133  (0) 2016.07.30
정보 올림피아드 - 132  (0) 2016.07.30
정보 올림피아드 - 130  (0) 2016.07.30
정보 올림피아드 - 548  (0) 2016.07.30
정보 올림피아드 - 547  (0) 2016.07.29

+ Recent posts