Given a string and write a C program to count the number of vowels and consonants in this string.
Input: str = "geeks for geeks" Output: Vowels: 5 Consonants: 8 Input: str = "abcdefghijklmnopqrstuvwxyz" Output: Vowels: 5 Consonants: 21
- Take the string as input
- Take each character from this string to check
- If this character is a vowel, increment the count of vowels
- Else increment the count of consonants.
- Print the total count of vowels and consonants in the end.
Below is the implementation of the above approach:
String: geeks for geeks Vowels: 5 Consonants: 8
- Modify string by removing vowels in between two consonants
- Program to count vowels in a string (Iterative and Recursive)
- Program to count vowels, consonant, digits and special characters in string.
- Count consonants in a string (Iterative and recursive methods)
- Program to duplicate Vowels in String
- Program to remove vowels from a String
- Count substrings that contain all vowels | SET 2
- Remove consecutive vowels from string
- Count number of Distinct Substring in a String
- C Program to count number of lines in a file
- C Program to count the Number of Characters in a File
- Lex program to count the number of lines, spaces and tabs
- Program to count number of distinct Squares and Cubes upto N
- C++ program to concatenate a string given number of times
- C program to print a string without any quote (singe or double) in the program
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.