For_10 대문자를 소문자로 변경하기


문자열(영문)을 입력 받아서 대문자를 소문자로 변경하고 변경한 글자 수를 나타내기

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#include <Windows.h>
 
int main(void) {
 
    int i;
 
    char str[100];
 
    printf("소문자와 대문자를 입력하세요.\n");
    scanf_s("%s"&str, sizeof(str));
 
    for (i = 0; i < sizeof(str); i++) {
        // 소문자로 바꿈
        if (str[i] >= 65 && str[i]<=90) {
            str[i] = str[i] + 32;
        }
    }
    printf("%s\n", str);
 
    system("pause");
    return 0;
}
cs

댓글