Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C program to “de-vowel” an input string. Assume that the user provides i

ID: 3723405 • Letter: W

Question

Write a C program to “de-vowel” an input string. Assume that the user provides input containing only the characters a through z (i.e., all lowercase letters). Your program should create an output string that deletes all vowels from the input string, pushing the letters together to ll 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 printing its output.

Sample Input: Enter a string: theturtleandthehare

Sample Output: De-vowel string is: thtrtlndthhr

Your program should use the following lines of code:

char input[80], output[80];

printf("Enter a string: ");

scanf("%s" , input);

Explanation / Answer

#include<stdio.h>
#include<string.h>
int main() {
char input[80], output[80];
int i,n,j=0;
printf("Enter a string: ");

scanf("%s" , input);
n = strlen(input);
for(i=0;i<n;i++) {
if(!(input[i]=='a' || input[i]=='e' || input[i]=='i'|| input[i]=='o'|| input[i]=='u')) {
output[j]=input[i];
j++;
}
}
output[j]='';
printf("De-vowel string is: %s ", output);
}

Output:

Enter a string: theturtleandthehare

De-vowel string is: thtrtlndthhr

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote