Sunday 11 December 2011

Write a program to print the Character and find out how many Vowel & Constant in c

#include
#include
main()
{
char n[20];
int j,v=0,c=0,as;
clrscr();
printf("Enter charactor:-\n");
gets(n);
for(j=0;n[j]!='\0';j++)
{
as=n[j];
if(as>=65 && as<=90)
{
if(n[j]=='A' || n[j]=='E' || n[j]=='I' || n[j]=='O' || n[j]=='U')
v++;
else
c++;
}
}
printf("Vowel= %d\n Constant= %d",v,c);
getch();
}


OUTPUT
Enter character:-MAHESH SOLANKI
Vowel = 6
Constant = 9

No comments:

Post a Comment