Dsa
Strings
Warm-up
Count Consonants
Write a program that counts the number of consonants in a given string. Consonants are all alphabetical characters that are not vowels (a, e, i, o, u). The counting should be case-insensitive. Output the total number of consonants found.
Example:
Input: "Hello, World!"
Output: 7
Key concepts
stringscountingconsonants
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now