fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. int main() {
  4. char s[100];
  5. int c = 0, i;
  6.  
  7. printf("Enter a string: ");
  8. fgets(s, 100, stdin);
  9.  
  10. for (i = 0; s[i] != '\0'; i++) {
  11. if (s[i] == 'a' || s[i] == 'A' || s[i] == 'e' || s[i] == 'E' || s[i] == 'i' || s[i] == 'I' || s[i] == 'o' || s[i] == 'O' || s[i] == 'u' || s[i] == 'U') {
  12. c++;
  13. }
  14. }
  15. printf("Vowels count: %d\n", c);
  16. return 0;
  17. }
Success #stdin #stdout 0s 5320KB
stdin
helloworldabcd
stdout
Enter a string: Vowels count: 4