fork download
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. int main() {
  4. char str[100];
  5. int vowels = 0, consonants = 0, digits = 0, specials = 0;
  6. fgets(str, 100, stdin);
  7. for (int i = 0; str[i] != '\0'; i++) {
  8. if (isalpha(str[i])) {
  9. if (str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u' ||
  10. str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U') {
  11. vowels++;
  12. } else {
  13. consonants++;
  14. }
  15. } else if (isdigit(str[i])) {
  16. digits++;
  17. } else if (str[i] != ' ' && str[i] != '\n') {
  18. specials++;
  19. }
  20. }
  21. printf("Vowels: %d, Consonants: %d, Digits: %d, Special symbols: %d\n", vowels, consonants, digits, specials);
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Vowels: 0, Consonants: 0, Digits: 0, Special symbols: 0