Case Count

Description:

C PROGRAM TO COUNT NUMBER OF UPPERCASE AND LOWERCASE LETTERS FROM A SENTENCE Test Case 1 Input (stdin) Arun IS a GooD$ Expected Output Uppercase Letters=5 Lowercase Letters=6 Test Case 2 Input (stdin) HELLO SRMM CHENN$ Expected Output Uppercase Letters=14 Lowercase Letters=0

Program :

  • #include <stdio.h>
    int main()
    {
      char str[100];
      int countl=0,countu=0;
      int counter;
        scanf("%[^\n]*c",str);
        for(counter=0;str[counter]!='\0' ;counter++)
      {
        if(str[counter]>='A' && str[counter]<='Z')
          countu++;
        else if(str[counter]>='a' && str[counter]<='z')
          countl++;
      }
      printf("\nUppercase Letters=%d",countu);
      printf("\nLowercase Letters=%d",countl);
     
       
    return 0;
    }