Advertisement
Kawsar_Hossain

Problem-2

Jul 29th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     char str[100];
  5.     int i,v=0,c=0,s=0,d=0;
  6.     gets(str);
  7.     for(i=0;str[i]!='\0';i++)
  8.     {
  9.         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' )
  10.         {
  11.             v++;
  12.         }
  13.         else if((str[i]>='a' && str[i]<='z') || (str[i]>='A' && str[i]<='Z'))
  14.         {
  15.             c++;
  16.         }
  17.         else if(str[i]>='1' && str[i]<='9')
  18.         {
  19.             d++;
  20.         }
  21.         else if(str[i]==' ')
  22.         {
  23.             s++;
  24.         }
  25.     }
  26.     printf("Number of vowel=%d\n", v);
  27.     printf("Number of consonant=%d\n", c);
  28.     printf("Number of digits=%d\n", d);
  29.     printf("Number of space=%d\n", s);
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement