fork(1) download
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main()
  5. {
  6.  
  7. char str[1000];
  8.  
  9. gets(str);
  10. int length=strlen(str);
  11.  
  12. int word=0;
  13. int vowel=0;
  14. int consonent=0;
  15. int i;
  16.  
  17. for(i=0;i<length;i++)
  18. {
  19. char temp = tolower(str[i]);
  20. if(temp==' ')
  21. {
  22. word++;
  23. }
  24. else{
  25. if(temp=='a'||temp=='e'||temp=='i'||temp=='o'||temp=='u')
  26. {
  27. vowel++;
  28. }
  29. else{
  30. consonent++;
  31. }
  32. }
  33. }
  34. printf("words:%d",word);
  35. printf("vowel:%d",vowel);
  36. printf("consonent:%d",consonent);
  37.  
  38. }
  39.  
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
words:0vowel:0consonent:6