Your key to unlimited learning
Posted on Apr 22, 2020
C program to eliminate/remove all vowels from a string.
#include<stdio.h> #include<conio.h> #include<string.h> #include<stdlib.h> #define MAX 50 void main() { char str[MAX]; int i, j, len, pos; printf("Enter the string\t:"); gets(str); len = strlen(str); for(i=0;i<len;i++) { if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u' || str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U') { pos = i+1; for(j=pos-1;j<len;j++) { str[j] = str[j+1]; } len = len-1; i--; } } str[len] = '\0'; printf("\nModified string\t:%s",str); getch(); }
Enter the string :welcome to coursecrux.com Modified string :wlcm t curscrx.cm