Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program that takes a string from user and prints the total number of vowels i.e. (a,e,i,o,u) present in the string.

Posted By: Rogelio Carter     Category: C Programming     Views: 11013

Write a program that takes a string from user and prints
the total number of vowels i.e. (a,e,i,o,u) present in the string.

Code for Program that takes a string from user and prints the total number of vowels i.e. (a,e,i,o,u) present in the string. in C Programming

#include<stdio.h>
    #include<conio.h>
    void main()
    {
        char a[21];
        int j,i;
        clrscr();
        printf("\n ************************************************\n");
        printf("\n Please Give The STRING OF A : ");
        scanf("%s",a);
        flushall();

        for(i=0,j=0;a[i]!='\0';i++)
        {
            if(a[i]=='a'|| a[i]=='A')
            j++;
            if(a[i]=='e'|| a[i]=='E')
            j++;
            if(a[i]=='i'|| a[i]=='I')
            j++;
            if(a[i]=='o'|| a[i]=='O')
            j++;
            if(a[i]=='u'|| a[i]=='U')
            j++;

        }
    

        printf("\n TOTAL NO. OF VOVELS ARE %d.",j);

    
        getch();
    }


********************* OUTPUT ***************************************************

     Please Give The STRING OF A : Hello

     TOTAL NO. OF VOVELS ARE 2.

*********************************************************************************
  
Share: 



Rogelio Carter
Rogelio Carter author of Program that takes a string from user and prints the total number of vowels i.e. (a,e,i,o,u) present in the string. is from New York, United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!