Notice
Recent Posts
Recent Comments
Link
«   2025/03   »
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
Tags
more
Archives
Today
Total
관리 메뉴

archive

[C언어 실습/기컴프 과제] 6.20 본문

C \ C++/22_1 기컴프 (C)

[C언어 실습/기컴프 과제] 6.20

안정민 2022. 6. 21. 21:19

프로그래밍연습 6.20

문자열을 입력 받고 대문자와 소문자의 수를 세는 C 프로그램을 작성하라

-

#include <stdio.h>
#include <ctype.h>

void main()
{
    char input[1000];
    int temp1 = 0, temp2 = 0;
    int count = 0;

    printf("문자열을 입력하세요 \n");
    gets_s(input);

    while (input[count]) {
        if (isupper(input[count])=1) 
            temp1++;
        else  
            temp2++;
        
    }
    printf("대문자 : %d\n", temp1);
    printf("소문자 : %d\n", temp2);
  
}

 

-