Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int main()
- {
- char string[100],ch;
- printf("Enter a string\n");
- gets(string);
- int i,vowel,consonant,word,digit,other;
- i=vowel=consonant=digit=word=other=0;
- while((ch=string[i])!='\0')
- {
- if(ch=='a' || ch=='i' || ch=='o' || ch=='u' || ch=='e' ||ch=='A' || ch=='I'|| ch=='O' || ch=='U' || ch=='E')
- vowel++;
- else if((ch>='a' && ch<='z') || (ch>='A' || ch<='Z'))
- consonant++;
- else if(ch>='0' && ch<='9')
- digit++;
- else if(ch==' ')
- word++;
- else
- other++;
- i++;
- }
- word++;
- printf("Number of vowels are %d\n",vowel);
- printf("Number of consonant are %d\n",consonant);
- printf("Number of digits are %d\n",digit);
- printf("Number of words are %d\n",word);
- printf("Number of others are %d\n",other);
- return 0;
- }
Add Comment
Please, Sign In to add comment