Friday, October 30, 2009

Chap9[F]k Removing two vowels in succession

Write a program to count the number of occurrences of any two vowels in succession in a line of text. For example, in the sentence “Pleases read this application and give me gratuity” such occurrences are ea, ea, ui.


void main()
{
char sent[]="Pleases read this application and give me gratuity";

int i,c;

for(i=0,c=0;sent[i]!='\0';i++)
{
if((sent[i]==97||sent[i]==101||sent[i]==105||sent[i]==117)&&(sent[i+1]==97||sent[i+1]==101||sent[i+1]==105||sent[i+1]==111||sent[i+1]==117))
c++;
}

printf("\nThere are %d occurences of two vowels in succession",c);
}

No comments:

Post a Comment