C Program to Find no of Vowels from a String

C Program to Find no of Vowels from a String using pointer . Compiled in Dev C++ .

 

#include<stdio.h>
#include<string.h>
#include<conio.h>
int Find_Vowels(char *);
main()
{
        char a[30];
        int vowel;
        printf("\n Program to Find no of Vowels from a String \n");
        printf("\n------------------------------------------------\n\n\n");
        printf("Enter Text : ");
        gets(a);

        strlwr(a);

        vowel=Find_Vowels(a);

        printf("\nNo of Vowels : %d ",vowel);

        getch();

}

 int Find_Vowels(char *a)
     {
        int length=0;
        int v=0,c=0,s=0;

        while(*a!='\0')
        {
           if((*a=='a')||(*a=='e')||(*a=='i')||(*a=='o')||(*a=='e')||(*a=='u'))
          {
              v++;                                                           

          }

          a++;
        }    

        return v;

     }

Output

vowel

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s