(4-5)Conditional

C/C언어 이론 2018. 10. 2. 20:57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
 
void main()
{
    // 입력된 점수에 따라 학점 출력
 
    int iScore = 0;
    printf("점수 입력 : ");
    scanf("%d"&iScore); // & 필수
 
    // 100점 : (만점)A학점
    // 0점     : (빵점)F학점
    if( iScore >= 90 ) // 입력한 점수가 90점 이상이면,
    {
        /*
        if( iScore == 100 )
        {
            printf("(만점)A학점\n");
        }
        else
        {
            printf("A학점\n");
        }
        */
 
        if( iScore == 100 )
        {
            printf("(만점)");
        }
 
        printf("A학점\n");
    }
    else if( iScore >= 80 ) // 입력한 점수가 80점 이상이면,
    {
        printf("B학점\n");
    }
    else if( iScore >= 70 ) // 입력한 점수가 70점 이상이면,
    {
        printf("C학점\n");
    }
    else  // 나머지
    {
        if( iScore == 0 )
        {
            printf("(빵점)");
        }
 
        printf("F학점\n");
    }
}
cs



       





'C > C언어 이론' 카테고리의 다른 글

(5-1)Repetitive  (0) 2018.10.02
(4-6)Conditional  (0) 2018.10.02
(4-4)Conditional  (0) 2018.10.02
(4-3)Conditional  (0) 2018.10.02
(4-2)Conditional  (0) 2018.10.02

설정

트랙백

댓글