-->

WAP to count number of vowels and consonants given in a text.

//WAP to count number of vowels and consonants given in a text.
#include<stdio.h>
include<conio.h>
#include<ctype.h>void main()
{                                                           
char name[30];                                                    
int i,vowel=0,cnst=0;
printf("enter string\n");
gets(name);

for(i=0;name[i]!='\0';i++)
{
if(name[i]==toupper(a)  || name[i]==toupper(e) || name[i]==toupper(i) || name[i]==toupper(o) || name[i]==toupper(u))
{
  vowel++;
}
else
{
  cnst++;
}
}
printf("total vowel present=%d\n",vowel);
printf("total consonant present=%d\n",cnst);
getch();
}
        

No comments:

Post a Comment