Write code to “de-vowel” an input string. Assume that the user provides input co
ID: 3672247 • Letter: W
Question
Write code to “de-vowel” an input string. Assume that the user provides input
containing only the characters a through z (and all lowercase). Your code should
create an output string that deletes all vowels from the input string, pushing the
letters together to fill any gaps. For example, given the input “theturtleandthehare”
your code should print out “thtrtlndthhr”.
Your program should create an output string from the input string, before
presenting its output, and should include the following lines:
char input[80],output[80];
printf("Enter a string: ");
scanf("%s",input);
this is a c program. conio.h may not be used.
Explanation / Answer
#include<stdio.h>
#include<string.h>
void main()
{
char input[80],output[80];
int i,c=0;
printf("Enter a string: ");
scanf("%s",input);
for(i=0;i<strlen(input);i++)
{
if(input[i]=='a' || input[i]=='e'|| input[i]=='i' || input[i]=='o'|| input[i]=='u')
continue;
else
{
output[c]=input[i];
c++;
}
}
printf("Input String is = %s",input);
printf(" Output String is = %s f",output);
system("pause");
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.