fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. char str[100];
  5. int i, count = 0;
  6.  
  7. printf("Enter a string: ");
  8. gets(str);
  9. for(i = 0; str[i] != '\0'; i++) {
  10. char ch = str[i];
  11. if (ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||
  12. ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U') {
  13. count++;
  14. }
  15. }
  16.  
  17. printf("Number of vowels: %d\n", count);
  18. return 0;
  19. }
  20.  
  21.  
  22.  
Success #stdin #stdout 0.01s 5324KB
stdin
HELLO OO
stdout
Enter a string: Number of vowels: 4