Sunday, 30 October 2016

program to count vowels and consonats using pointer

#include<stdio.h>
int main()
{
char a[20],t,m,*p;
int i;
printf("enter the string");
gets(a);
p=a;
for(i=0;*(p+i)!='\0';i++)
{
if(*(p+i)=='a'||*(p+i)=='e'||*(p+i)=='i'||*(p+i)=='o'||*(p+i)=='u')
{
t++;
}
 else 
   m++;
}
printf("the total number of vowels :%d",t);
printf("\nthe total number of consonats :%d",m);
}

No comments:

Post a Comment