Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
546 B
4
Indexable
#include <stdio.h>
#include <string.h>
int main() {

  char input[500];
  int v=0, c=0;
  printf("Enter a input of string: ");
  fgets(input, sizeof(input), stdin);
  for (int i = 0; input[i] != '\0'; ++i) {

    input[i] = tolower(input[i]);
    if (input[i] == 'a' || input[i] == 'e' || input[i] == 'i' ||
        input[i] == 'o' || input[i] == 'u') {
        v++;
    }
    else if ((input[i] >= 'a' && input[i] <= 'z')) {
      c++;
    }
  }
  printf("Vowel: %d", v);
  printf("\nConsonant: %d", c);


  return 0;
}