Monday, July 17, 2017

C program for vowels

This program check the present vowels in given word by the user. user can give any word or sentence this program analyse that program
and gives no of vowels present in the program and positions of individual vowels.

ex.
         User enter "Welcome" than program do
               total 3 vowels found
               'e' at position=2
               'o' at position=5
               'e' at position=7

         This type of operation is going to done by this program.

Program:

#include<stdio.h>
int main()
{
    int i,j,n,count;
    char word[25],c;
    char vowels[]={'a','e','i','o','u','A','E','I','O','U'};
    do{
        count=0;
        n=0;
        printf("\n Enter any word=");
        scanf("\n%s",word);
        for(i=0;word[i]!='\0';i++)
        n++;
        for(i=0;i<n;i++)
        {
            for(j=0;j<10;j++)
            {
                if(word[i]==vowels[j])
                {
                printf("\n%c is vowels found at position %d",vowels[j],i+1);
                count++;
                }
            }
        }
        if(count==0)
        printf("\nNo vowels is found in word");
        else
        printf("\nTotal %d vowels found",count);
        printf("\nDo you want to check any other word(y/n)=");
        scanf("\n%c",&c);
    }while(c=='y'||c=='Y');
    printf("\nThank you...\n");
    return 0;
}

Output:


Please comment and give Suggestion on this post, if you want any other program or help then type in comment or contact me, and give feedback for this blogs.

No comments:

Post a Comment

Acer Nitro 5 Ryzen 7 4800H - Blender Open Data Benchmark | Blender BMW Benchmark

Hello friends in this video I have perform benchmark of Acer Nitro 5 Ryzen 7 4800H laptop using Blender Open data Benchmark tool. In this to...