delete 2fremove vowels from string in c

Solutions on MaxInterview for delete 2fremove vowels from string in c by the best coders in the world

showing results for - "delete 2fremove vowels from string in c"
Sam
06 Sep 2018
1// Delete Vowels from String in C
2/*
3follow below link for best answer: 
4-------------------------------------------------
5https://codescracker.com/c/program/c-program-delete-vowels-from-string.htm
6*/
7#include<stdio.h>
8#include<conio.h>
9int main()
10{
11    char str[50];
12    int i=0, j, chk;
13    printf("Enter a String: ");
14    gets(str);
15    while(str[i]!='\0')
16    {
17        chk=0;
18        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')
19        {
20            j=i;
21            while(str[j-1]!='\0')
22            {
23                str[j] = str[j+1];
24                j++;
25            }
26            chk = 1;
27        }
28        if(chk==0)
29            i++;
30    }
31    printf("\nString (without vowels): %s", str);
32    getch();
33    return 0;
34}