Search This Blog

C Program Find Vowel Consonant Space In Given Word Using SwitchCase

C Program Find Vowel Consonant Space In Given Word Using SwitchCase :
//C Program Find Vowel Consonant Space In Given Word Using SwitchCase

#include<stdio.h>
#include<conio.h>
void main()
{
char word[50];
int i=0,c=0,v=0,s=0;
clrscr();
puts("\n\n Enter any word: ");
gets(word);
while(i<50 && word[i]!=NULL)
{
switch(word[i])
{
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
printf("\n %c is a vowel",word[i]);
v++;
break;
default:
{
if(word[i]==' ')
{printf("\n \t space");s++;
break;}
else
{
printf("\n %c is a constant",word[i]);
c++;
break;
}}}
i++;
}
printf("\n\n Total vowels is: %d", v);
printf("\n Total consonant is: %d", c);
printf("\n Total space is: %d",s);
getch();
}
OUTPUT
C Program Find Vowel Consonant Space In Given Word

No comments:

Post a Comment