/*WAP to count how many number of vovels in the given string and print on output screen*/
#include<stdio.h> #include<conio.h> #include<string.h> void main() { int count=0,i; char a[25],b[25]; clrscr(); printf("Enter a strting:"); gets(a); for(i=0;a[i]!='\0';i++) { if(a[i]=='a' || a[i]=='i' || a[i]=='o' || a[i]=='u' || a[i]=='e') { strcpy(&b[i],&a[i]); count+=1; } else { printf("%c",a[i]); } } printf("\n Total vovels: %d",count); getch(); }
No comments:
Post a Comment