Friday, April 10, 2015

25. Write a program to count the number of vowels and consonants in a given text.

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,count=0,length;
char string[100];
clrscr();
printf("\n Input and text:- ");
gets(string);
strlwr(string);
length= strlen(string);
for(i=0;i<length;i++)
{
if(string[i]=='a'||string[i]=='e'||string[i]=='i'||string[i]=='o'||string[i]=='u')
count++;
}
printf("\n there are %d vowels",count);
getch();
}

No comments:

Post a Comment