Answer to Question #275367 in C for Amy

Question #275367

Write a value-returning function, isVowel, that returns the value true if a given character is a vowel, and otherwise returns false. Explain your code.


1
Expert's answer
2021-12-04T01:27:38-0500
#include <stdio.h>


//This function allows to check if the character is  vowel
int isVowel(char ch){
	if ((ch == 'A') || (ch == 'E')|| (ch == 'I')|| (ch == 'O')|| (ch == 'U')|| (ch == 'a')|| (ch == 'e')||
		(ch == 'i')|| (ch == 'o')|| (ch == 'u')) {
			return 1;//return true
	}  
	else {
		return 0;//return false
	}
}


int main() {  


	char character;
	//read character from the keyboard
	printf("Enter character: ");
	scanf("%c",&character);
	//check if the character is  vowel 
	if(isVowel(character)==1){
		printf("%c is a vowel\n",character);
	}else{
		printf("%c is NOT a vowel\n",character);
	}
	//delay
	getchar();
	getchar();
	return 0;


}  

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS