Program
#include <stdio.h>
void cal();
int main()
{
cal();
}
void cal()
{
char str[100];
int countDigits,countAlphabet,countSpecialChar,countSpaces;
int counter;
countDigits=countAlphabet=countSpecialChar=countSpaces=0;
printf("Enter a string: ");
gets(str);
for(counter=0;str[counter]!=NULL;counter++)
{
if(str[counter]>='0' && str[counter]<='9')
countDigits++;
else if((str[counter]>='A' && str[counter]<='Z')||(str[counter]>='a' && str[counter]<='z'))
countAlphabet++;
else if(str[counter]==' ')
countSpaces++;
else
countSpecialChar++;
}
printf("\nDigits: %d \nAlphabets: %d \nSpaces: %d \nSpecial Characters: %d",countDigits,countAlphabet,countSpaces,countSpecialChar);
return 0;
}
Output:
Enter a string: ARS ProZone
Digits: 0
Alphabets: 10
Spaces: 1
Special Characters: 0
1 Comments
Casino near Santa Barbara (CA) - Mapyro
ReplyDeleteCasino near Santa 과천 출장안마 Barbara (CA) 계룡 출장샵 with 천안 출장안마 location, reviews and information for 정읍 출장안마 Casino near Santa Barbara in 영천 출장안마 Santa Barbara: Casino Near Me. Mapyro