C Program to Count Vowels, and Consonants in a String

In this tutorial you will learn about the C Program to Count Vowels, and Consonants in a String and its application with practical example.

C Program to Count Vowels, and Consonants in a String

In this tutorial, we will learn to create a C program that will Count the Vowels and Consonants in a String in C programming

Table Of Contents

Prerequisites

Before starting with this tutorial, we assume that you are the best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • For loop in c programming.

Algorithm:-

Count the Vowels and Consonants in a String

As we all know, the String is a collection of all characters. In strings, only one variable is declared which can store multiple values. First, will take the line of string from the user. Then will filter the number of vowels and the consonants from that strings. At last, we will print the result numbers.

With the help of this program, we can Count the Vowels and Consonants in a String.

Program Code:-

 

Output:-

In the above program, we have first initialized the required variable.

  • s[1000] = it will hold the string value.
  • Vowels = it will hold the integer value for vowels.
  • Consonant  = it will hold the integer value for consonants.
  • i = it will hold the integer value.

Input strings from the user.

Filtering the vowels and the consonants from the string.

Printing output numbers of the vowels and the consonants.

In this tutorial we have learn about the C Program to Count Vowels, and Consonants in a String and its application with practical example. I hope you will like this tutorial.