I wrote the following code in C to delete the vowels in a sentence:
#include <stdio.h>
#include <conio.h>
int main()
{
char c[200],c1[200];
int i,j;
printf("enter the string: ");
gets(c);
for(i=0,j=0;c[i]!='\0';i++)
{
if(c[i]=='a' || c[i]=='e' || c[i]=='i' || c[i]=='o' || c[i]=='u');
else
{
c1[j++]=c[i];
}
}
printf("string after removal of vowels: %s",c1);
}
Normally, all types of input works, but if we use "a" two times as input, in the start once, and at the end of the string, it gives error:
Input: jjhakl jhga
Output: jjhkl jhg@
Expected Output: jjhkl jhg
It works okay if the total string length is less, try longer string to get the error.