C program to count the number of vowels and consonants in a word

C program to count the number of vowels and consonants in a word

#include <stdio.h>

int main(){
	
	// declare string (character array) to hold the input string
	char inputString[100];
	
	// prompt the user to enter a string
	printf("Enter a single word: ");
	
	// get the input
	scanf("%s\n", inputString);
	
	// initialise loop variables for counting the vowels and consonants
	int i = 0;
	int vowelCount = 0;
	int consonantsCount = 0;
	
	
	// Use a loop to iterate through the input string 
	while(inputString[i] != '\0'){
		
		// count the variables and consonants
		if(inputString[i] == 'a' ||inputString[i] == 'e' || inputString[i] == 'i'|| inputString[i] == 'o'|| inputString[i] == 'u'){
			vowelCount++;
			}
		else{
			consonantsCount++;
			 }
		i++;
		}
		
		if(vowelCount == 1 && consonantsCount !=1 ){
			printf("There is a single vowel and %d consonants in %s", consonantsCount, inputString);
			}
		else if(vowelCount != 1 && consonantsCount ==1){
			printf("There are %d vowels and a single consonant in %s", vowelCount, inputString);
			}
		else if(vowelCount == 1 && consonantsCount ==1 ){
			printf("There is a single vowel and a single consonant in %s", inputString);
			}
		else{
			printf("There are %d vowels and %d consonants in %s", vowelCount, consonantsCount, inputString);
			}
		
			return 0;
			
	}