/*C program to count vowels and consonants in a string using pointer.*/
/*C program to count vowels and consonants in a string using pointer.*/
/*C program to count vowels and consonants in a string using pointer.*/
C program to count vowels and consonants in a string using pointer.

Gapfill exercise

  

#include <stdio.h>
int main()
{
char str[100];
char *ptr;
int cntV,cntC;

printf("Enter a string: ");
gets(str);

ptr=str;

cntV=cntC=0;
while(*ptr!='\0')
{
if(*ptr=='A' ||*ptr=='E' ||*ptr=='I' ||*ptr=='O' ||*ptr=='U' ||*ptr=='a' ||*ptr=='e' ||*ptr=='i' ||*ptr==')
cntV++;
else
cntC++;
;
}

printf("Total number of VOWELS: %d, CONSONANT: %d\n",cntV,cntC);
return 0;
}


2.GIF