For_12 영문피라미드 출력하기




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
#include <stdio.h>
#include <Windows.h>
 
int main(void) {
 
 
    char a = 0;
    int i = 0;
    int j = 0;
 
    int count;
 
    int ccc = 1;
 
    while (ccc) {
 
        printf("대문자를 입력하세요\n");
        scanf_s("%c"&a, sizeof(a));
 
        if (a >= 65 && a <= 90) {
            ccc = 0;
        }
        else{
            printf("대문자를 입력하세요\n");
        }
    }
 
    count = a - 64;
 
    for (i = 0; i < count; i++) {
         
        for (j = count-i; j >= 0; j--) {
            printf(" ");
        }
 
        for (j = 65; j <= 65 + i; j++) {
            printf("%c", j);
        }
 
        for (j = 64 + i; j >= 65; j--) {
            printf("%c", j);
        }
 
        printf("\n");
    }
 
    system("pause");
    return 0;
}
cs

댓글