Character Between Two Vowels
C CODE:
#include<stdio.h>
#include <stdlib.h>
int main()
{
char a[100];
scanf("%s",a);
int i,j,k=0,l;
l=strlen(a);
for(i=0;i<l;i++)
{
for(j=i+2;j<l;j++)
{
if((a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')&&(a[i+2]=='a'||a[i+2]=='o'||a[i+2]=='e'||a[i+2]=='u'||a[i+2]=='i'))
{
printf("%c",a[i+1]);
k=1;
break;
}
}
}if(k==0)
printf("-1");
}
Comments
Post a Comment