Enter the string find total number of vowels replace it with star

Write a program to enter the user define string and print it. Also find the total number of vowels in given string and put * in replace of every vowel.


Source Code:

#include<stdio.h>
#include<conio.h>
void main()
{
	 char a[20];
	 int I,count=0;
	 clrscr();
	 printf("Enter the String:");
	 gets(a);
 printf("Given String is:\n");
	 for(i=0;a[i]!=NULL;i++)
	 {
		printf("%c",a[i]);
	 }
	 for(i=0;a[i]!=NULL;i++)
	 {
		if(a[i]=='a' || a[i]=='e' || a[i]=='i' || a[i]=='o' || a[i]=='u' || a[i]=='A' || a[i]=='E' || a[i]=='I' || a[i]=='O' || a[i]=='U')
		{
			count++;
			a[i]='*';
		}
	 }
	 printf("Given string is:%s",a);
	 getch();
}

Output:

Enter the String: Bhavesh Jain
Given String is: Bhavesh Jain

Given string is: Bh*v*sh J**n

Leave a Reply

Your email address will not be published. Required fields are marked *