Write a program to delete all vowels from a sentence. Assume that the sentence is not
more than 80 characters long.
#include<stdio.h>
main()
{
char vowel[80]; //Sentence must not be 80 character long
char array[5]; //Vowels are five
char line_new[80]; //New sentence that will be formed
char vo;
int n=0,x=0;
int count_vowel =0; //Counting vowels
printf("Enter sentence to remove the vowels:\n");
gets(vowel);
while(vowel[n]!='\0')
{
vo=toupper(vowel[n]); //Converting the sentence to upper case
if(vo=='A'||vo=='E'||vo=='I'||vo=='O'|| vo=='U')
{
count_vowel++;
}
else
{
line_new[x]=vowel[n];
x++;
}
n++;
}
line_new[x]='\0';
printf("\n%d vowels removed \n",count_vowel);
printf("\nThe final line becomes : \n%s",line_new);
}
Comments
Leave a comment