Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- char str[100];
- int i,v=0,c=0,s=0,d=0;
- gets(str);
- for(i=0;str[i]!='\0';i++)
- {
- if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u' || str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U' )
- {
- v++;
- }
- else if((str[i]>='a' && str[i]<='z') || (str[i]>='A' && str[i]<='Z'))
- {
- c++;
- }
- else if(str[i]>='1' && str[i]<='9')
- {
- d++;
- }
- else if(str[i]==' ')
- {
- s++;
- }
- }
- printf("Number of vowel=%d\n", v);
- printf("Number of consonant=%d\n", c);
- printf("Number of digits=%d\n", d);
- printf("Number of space=%d\n", s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement