C Program to Remove Vowels from String

C Program to Remove Vowels from String

Write a Program to Remove Vowels from String

// C Program to Remove Vowels from String

#include <stdio.h>
#include <string.h>

int main()
{
	char S[100];
	int n;

	printf("Enter String :--> ");
	gets(S);


	n = strlen(S);
	int i = 0 ,flag = 0;

	while(i < n)
	{
	 	if(S[i] == 'a' || S[i] == 'e' || S[i] == 'i' || S[i] == 'o' || S[i] == 'u')
	 	{
	 		flag = 1;
	 		int j = i;
	 		while(j < n - 1)
	 		{
	 			S[j] = S[j+1];
	 			j++;
			 }
			 n--;
			 i--;
		 }
		 i++;
	}
	S[i] = '\0';
        printf("New string is :--> %s", S);


	return 0;
}

Output:

Enter String :--> Hello and Welcome to CodeCrucks
New string is :--> Hll nd Wlcm t CdCrcks