Design a C program to remove the symbol @ present in the sting and then count total number of Capital and Small case of alphabets from the given input string.
Runtime Input :
funDam@EntalS
Output :
3 9
#include <stdio.h>
int main()
{
char str[100];
int countLowercase, countUpperCase;
int counter;
//assign all counters to zero
countLowercase = countUpperCase = 0;
printf("Enter a string: ");
gets(str);
for(counter=0;str[counter]!=NULL;counter++){
if(str[counter]>='A' && str[counter]<='Z')
countUpperCase++;
else if(str[counter]>='a' && str[counter]<='z')
countLowercase++;
}
printf("Total Upper case characters: %d\nLower Case characters: %d", countUpperCase, countLowercase);
return 0;
}
Comments
Leave a comment