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,countU;

int counter;

countL=countU=0;

scanf ("%[^\n]s",str);

for(counter=0;str[counter]!=NULL;counter++){

if(str[counter]>='A' && str[counter]<='Z')

countU++;

else if(str[counter]>='a' && str[counter]<='z')

countL++;

}

printf("Uppercase Letters=%d\nLowerCase Letters=%d",countU,countL);

return 0;

}