Remove all vowels from the given String | AMCAT Automata Question | AMCAT Coding Question

These question was asked in AMCAT Automata Examination. 

Write a program to remove all vowels from the given string. 


remove vowels from string


#include <stdio.h>

int main(void) {
    char a[20];
    int i=0;
    printf("Enter a lowercase String: ");
    gets(a);
    while(a[i]!='\0')
    {
        if(a[i]>95 && a[i]<122)
        {
            if(a[i]=='a'||a[i]=='e'
            ||a[i]=='i'||a[i]=='o'
            || a[i]=='u'){
             // do nothing
            }
            else{
             printf("%c",a[i]); 
            }
        }
        else
            printf("%c",a[i]); 
    // to print spaces between words
        i++;
    }
 return 0;
}


Input :  How are you
Output: Hw r y      






Check Out More Questions from AMCAT Automata Test : Click here

Post a Comment

0 Comments