Untitled
unknown
plain_text
4 months ago
1.0 kB
2
Indexable
#include<stdio.h> #include<string.h> int main (){ char str [1000],ch ; int i , vowel,consonent,digit,word,other; printf ("Enter a string : "); gets(str); i = vowel = consonent = digit = word= other= 0 ; while ((ch=str[i])!='\0'){ if (ch == 'a'|| ch == 'e' || ch ='i'|| ch == 'o'|| ch== 'u'|| ch == 'A'|| ch == 'E' || ch ='I'|| ch == 'O'|| ch== 'U'|| ){ vowel++ ;} else if ((ch>= 'a' && ch <='z')|| (ch>= 'A' && ch <='Z') ){ consonent++ ;} else if (ch>= '0'&&ch<=9){ digit++ ;} else if (ch == ' '){ word++ ;} else{ other++ ;} i++ ; } word++ ; printf ("Number of Vowel : \n",vowel); printf ("Number of Consonent : \n",consonent); printf ("Number of digit : \n",digit); printf ("Number of word : \n",word); printf ("Number of other : \n",other); return 0 ; }
Editor is loading...
Leave a Comment