Answer to Question #205284 in C for Imran

Question #205284

Write a program to delete all vowels from a sentence. Assume that the sentence is not 

more than 80 characters long.


1
Expert's answer
2021-06-13T00:03:26-0400
#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);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS