Friday, October 30, 2009

Chap9[F]h Deleting all vowels from a sentence

Write a program to delete all vowels from a sentence. Assume that the sentence is not more than 80 characters long.

void main()
{
char sent[]="She sells seashells on the seashore";

int i;

for(i=0;sent[i]!=0;i++)
{
if(sent[i]==97||sent[i]==101||sent[i]==105||sent[i]==111||sent[i]==117)
{
for(;sent[i+1]!=0;i++)
sent[i]=sent[i+1];

sent[i]='\0';

i=-1;
}
}
printf("\n%s",sent);
}

3 comments: