Advertisement
Niloy007

Vowel Or Consonant

Jul 5th, 2020
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main() {
  4.     char string[1000];
  5.     gets(string);
  6.     int i = 0, countVowel = 0, countConsonant = 0;
  7.  
  8.     while (string[i] != '\0') {
  9.         if(string[i] == 'a' || string[i] == 'e' || string[i] == 'i' || string[i] == 'o' || string[i] == 'u') {
  10.             countVowel++;
  11.         } else {
  12.             countConsonant++;
  13.         }
  14.         i++;
  15.     }
  16.     printf("Vowel: %d\nConsonent: %d\n", countVowel, countConsonant);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement