Today we will write a program in c in which we will replace all those vowels in string by a special symbol.
If we talk about the strategy of this program, then the strategy is very simple, we will take a sting from the user and a special symbol by which we will replace the vowels that given special symbol. Let's get started...
#include <stdio.h>
#include <conio.h>
int main() {
char str[100], ch;
printf("\nEnter the String : ");
gets(str);
printf("\nEnter Any Symbol which to Replace : ");
scanf("%c", &ch);
for(int i = 0; str[i] != '\0'; 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'){
str[i] = ch;
}
}
printf("After Replace : %s", str);
return 0;
}
/*
Enter the String : lapmos
Enter Any Symbol which to Replace : $
After Replace : l$pm$s
*/
Comments
Oops!