BeginnersBook.in

Programming For Geeks

  • Home
  • All Tutorials
    • Learn C
    • Learn Python
  • Programs
    • Java Programs
    • C++ Programs
    • C Programs
  • Algorithms
    • Sorting
  • MCQ’s
    • MySQL
    • Operating System
  • WordPress
    • Genesis Pro Themes
    • Blogs
  • Tools
    • Direct Download Link Generator
    • HTML Compiler
  • How to
    • Web Examples
  • Write For Us

C Program to Count Vowels in Sentence

April 14, 2018 By Mr. Robot

In this program, you will learn to count all vowels in a sentence (entered by the user).

Following example shows the output of the program:

1
2
Input: Hello C Programming
Output: 5 (vowels)

Example: Program Count Vowels in Sentence

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<stdio.h>
#include<string.h>
int main()
{
    int i,vowelcount = 0;
    char str[100];
    printf("Enter a sentence or string: \n");
    gets(str);
    for(i = 0; i < strlen(str); i++)
    {
        if(str[i]=='A'||str[i]=='a'||str[i]=='e'||str[i]=='E'
        ||str[i]=='I' ||str[i]=='i'||str[i]=='O'||str[i]=='o'
        ||str[i]=='U'||str[i]=='u')
        {
            vowelcount++;
        }
    }
    printf("%d\n",vowelcount);
    //exit status
    return 0;
}
When you run the program, the output will be following:
1
2
3
Enter a sentence or string:                                                                                                    
i am a programmer                                                                                                              
6

Filed Under: C Examples

Related Posts

  • C Program to Check Whether a Number is Magic Number or Not
  • C Program to Swap Two Numbers Using Third Variable
  • C Program to Check Whether a Number is Perfect Number or Not

Recent Posts

  • Download Grand Theft Auto: Vice City Audio File | Highly Compressed
  • Grand Theft Auto: Vice City Game Download For PC | Full Setup
  • SQL SHOW DATABASES Statement
  • Direct view storage Tube (DVST) in Computer Graphics
  • CRT Color Monitor in Computer Graphics

More…

  • C Tutorial

C Examples

  • Hello, World
  • Add Two Numbers
  • Area of Triangle
  • Sum of All Digits
  • Characters a to z
  • Characters A to Z
  • Check Leap Year
  • Reverse a Number
  • Palindrome Number
  • Sum of N Numbers
  • Multiply Using Addition
  • Print 1 to 10 Numbers
  • Even or Odd Number
  • Armstrong Number
  • Swap Using Temp
  • Swap Without Temp
  • Find Largest Numbers
  • Check Prime Number
  • Max Prime Number
  • Fibonacci Series
  • Numbers Divisible by 2
  • Factorial of a Number
  • Convert Total Days
  • Add Digits of Number
  • Count Whitespaces
  • Count Vowels
  • Magic Number
  • Happy Number
  • Strong Number
  • Perfect Number
  • Length of String
  • Count Words
  • Get More 200+ Examples ..

Copyright © 2019 - BeginnersBook.in - All Right Reserved || Sitemap