montimaj

CONS_VOW

Nov 14th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include<ctype.h>
  2. #include<stdio.h>
  3. int main(){
  4.     char st[]="Hello World! I am Anirban";
  5.     int ncons=0,nvow=0,size=sizeof(st)/sizeof(st[0]),i;
  6.     for(i=0;i<size;++i){
  7.             char c=tolower(st[i]);
  8.             if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u')
  9.                 nvow++;
  10.             else if(c>='a' && c<='z')
  11.                 ncons++;
  12.     }
  13.     printf("No. of vows= %d\nNo. of cons= %d\n",nvow,ncons);
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment