Advertisement
kiwser

Vowels count from string

Aug 22nd, 2021
1,018
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     char line[150];
  5.     int vowels;
  6.  
  7.     vowels = 0;
  8.  
  9.     printf("Enter a line of string: ");
  10.     fgets(line, sizeof(line), stdin);
  11.  
  12.     for (int i = 0; line[i] != '\0'; ++i)
  13.     {
  14.         if (line[i] == 'a' || line[i] == 'e' || line[i] == 'i' ||
  15.             line[i] == 'o' || line[i] == 'u' || line[i] == 'A' ||
  16.             line[i] == 'E' || line[i] == 'I' || line[i] == 'O' ||
  17.             line[i] == 'U')
  18.             {
  19.              ++vowels;
  20.             }
  21.     }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement