Tuesday, October 21, 2014

consnent,vowel,special character

#include<stdio.h>
#include<string.h>
void main()
{
char str[100];
int i,v,c,sp,sc;
printf("enter the string");
i=0,v=0,c=0,sp=0,sc=0;
gets(str);

while(str[i]!='\0')
{
if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')
{
v++;
}

else if(str[i]>='a' && str[i]<='z')
{
c++;
}
else if(str[i]==' ')
{
sp++;
}
else
{
sc++;
}
i++;
}
printf("\n vowel%d",v);
printf("\n consonent%d",c);
printf("\n space%d",sp);
printf("\n spcial character%d",sc);
}

No comments:

Post a Comment