Translate

Labels

Friday 28 December 2012

COUNTING NUMBER OF VOWELS IN A STRING

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i, len, v;
char s[20];
clrscr();
printf("Enter a string: ");
scan f("%s",s);
len=strlen(s);
v=0;
for(i=0;i<len;i++)
{
if(s[i]= ='a'||s[i]= ='e'||s[i]= ='i'||s[i]= ='o'||s[i]= ='u')
v=v+1;
}
printf("Number of vowels in a string:%d",v);
getch();
}

No comments: