fork(2) download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. char sentence[30];
  6. int i, vowels = 0;
  7.  
  8. printf("Enter a sentence \n");
  9. scanf("%s", sentence);
  10.  
  11.  
  12. for (i = 0; sentence[i]; i++);
  13. {
  14. if((sentence[i] == 'a' || sentence[i] == 'e' || sentence[i] == 'i' || sentence[i] == 'o' || sentence[i] == 'u' || sentence[i] == 'A' || sentence[i] == 'E' || sentence[i] == 'I' || sentence[i] == 'O' || sentence[i] == 'U'))
  15.  
  16. {
  17. vowels = vowels +1;
  18. }
  19.  
  20. }
  21.  
  22. printf("There are %d vowels in the sentence\n", vowels);
  23. return 0;
  24. }
Success #stdin #stdout 0s 2296KB
stdin
hey
stdout
Enter a sentence 
There are 0 vowels in the sentence