answersLogoWhite

0


Best Answer

// short version

char c = 'a';

System.out.println((c=='a'c=='e'c=='i'c=='o'c=='u')?"VOWEL":"CONSONANT");

// easy to read version

char c = 'a';

switch (c) {

case 'a':

case 'e':

case 'i':

case 'o':

case 'u':

System.out.println("VOWEL");

break;

default:

System.out.println("CONSONANT");

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: WAP to initilize a character and print whether it is a vowel or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a program that stores vowels in an array When you program is given a character it should indicate whether the character is vowel or not?

That's easy to do!This script will get the POST data from an HTML form and check if it is a vowel.


What is the C program to check whether a given character is vowel or not using switch case?

#includemain(){char ch;clrscr();pritnf("\nEnter any character:");fflush(stdin);scanf("%c",&ch);if (ch 'U' ch = 'u'){printf("\n The entered character %c is Vowel.\n", ch);}else{printf("\nThe entered character %c is not Vowel.\n",ch);}}


A c plus plus program that defines vowels?

#include<locale> #include<iostream> #include<string> bool is_vowel(const char c) { static const std::string vowels = "AEIOU"; return( vowels.find(toupper(c))<vowels.size() ); } int main() { std::string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for(size_t i=0; i<alphabet.size(); ++i) { std::cout<<'\''<<alphabet[i]<<"\' is "; if( !is_vowel( alphabet[i] )) std::cout<<"not "; std::cout<<"a vowel."<<std::endl; } } Output: 'a' is a vowel. 'b' is not a vowel. 'c' is not a vowel. 'd' is not a vowel. 'e' is a vowel. 'f' is not a vowel. 'g' is not a vowel. 'h' is not a vowel. 'i' is a vowel. 'j' is not a vowel. 'k' is not a vowel. 'l' is not a vowel. 'm' is not a vowel. 'n' is not a vowel. 'o' is a vowel. 'p' is not a vowel. 'q' is not a vowel. 'r' is not a vowel. 's' is not a vowel. 't' is not a vowel. 'u' is a vowel. 'v' is not a vowel. 'w' is not a vowel. 'x' is not a vowel. 'y' is not a vowel. 'z' is not a vowel. 'A' is a vowel. 'B' is not a vowel. 'C' is not a vowel. 'D' is not a vowel. 'E' is a vowel. 'F' is not a vowel. 'G' is not a vowel. 'H' is not a vowel. 'I' is a vowel. 'J' is not a vowel. 'K' is not a vowel. 'L' is not a vowel. 'M' is not a vowel. 'N' is not a vowel. 'O' is a vowel. 'P' is not a vowel. 'Q' is not a vowel. 'R' is not a vowel. 'S' is not a vowel. 'T' is not a vowel. 'U' is a vowel. 'V' is not a vowel. 'W' is not a vowel. 'X' is not a vowel. 'Y' is not a vowel. 'Z' is not a vowel.


What is the flowchart C program to check wether a given character is vowel or not using switch case?

Switch case can be flowcharted using a diamond for each case, with a right branch for true and a down branch for false. The false branch simply connects to the next case. The true branch connects to the statement that should be executed for that case. Where multiple cases result in the same statement, the true branches should converge upon that statement. The execution path from the statement(s) should converge with the final false branch of the switch case. In this case, your switch case might be as as follows: print %letter% switch lowercase (%letter%) { case 'a': case 'e': case 'i': case 'o': case 'u': print line " is vowel" break; default: print line " is not vowel" } Thus you will have a column of diamonds for each case with false branches linking downwards from one diamond to the next. The statement for case 'a', 'e', 'i', 'o' and 'u' is the same, so their true branches (extending to the right) will converge upon the 'print line " is vowel"' statement which must be placed to the right of the case diamonds. The default case's true branch leads to the 'print line " is not vowel"' statement. Both these statements will then converge with the false branch from the default case, marking the end of the switch case. Note that, logically, there is no false branch from a default case, thus this link may be omitted. However, all links from all statements must still converge below the default case.


When should a switch statement be used?

switch is a loop which is used for checking various conditions and print corresponding matter.switch(a)//where a is that whose condition you have to check.#includemain(){char a;printf("enter a char.");scanf("%c",&a);switch(a){case 'a':printf("vowel");break;case 'e':printf("vowel");break;case 'i':printf("vowel");break;case 'o':printf("vowel");break;case 'u':printf("vowel");break;default:printf("consonent");}}

Related questions

Write a program to print whether the letter is vowel or not in BASIC?

vowels$ = "aeiou" CLS PRINT "PROGRAM: Find if letter is a vowel or not" PRINT INPUT "Type a single alphabet letter: (a-z)/and, then, press Enter key"; aLetter$ PRINT PRINT "Letter "; aLetter$; IF INSTR(vowels$, LCASE$(aLetter$)) THEN PRINT " is a vowel." ELSE PRINT " is NOT a vowel." END


How do you write algo for switch case?

input (alphabets) output(vowel or not vowel) operator(a,e,i,o,u) switch(alphabets) { case 'a' print"vowel" case'b' print"not vowel" case'e' print"vowel" case 'i' print"vowel" case 'o' print"vowel" case'u' print"vowel"


Write a program that stores vowels in an array When you program is given a character it should indicate whether the character is vowel or not?

That's easy to do!This script will get the POST data from an HTML form and check if it is a vowel.


Write a program to adentify whether a character entered by a user is a vowel or a consonant?

You can check the value of a character by using if statements.Also, note that this code does not check for capital letters./* code */#include int main(){char c;c = getc(stdin);if (c 'o') {/* If the character is a vowel, this code will be executed. */} else if (c >= 'a' && c


What does boin mean in Japanese?

Boin can either mean 'Thumb print' or 'Vowel'


How is reading related to long vowel worksheets?

You don't have to make the long vowel worksheets if you go to vowel reading dot com. They have ready made worksheets for you to download, save and print for everyone.


Is the word new a short or long vowel word?

The vowel in new is long, whether it is pronounced noo or nyoo.


What is the symbol that denotes the vowel sound called?

The symbol that denotes the vowel sound is called a vowel symbol or a vowel character. It is used to represent specific vowel sounds in phonetic transcription or in the International Phonetic Alphabet (IPA).


Is the y in January a vowel?

No, the y in January is not considered a vowel in this context. It is functioning as a consonant due to its pronunciation in the word "January."


Where can long vowel worksheets be gotten?

Kidslearningstation has all kinds of worksheets that you can print and use, including long vowel forms. Funfonix is another site that lets you get these same type of worksheets.


What is the C program to check whether a given character is vowel or not using switch case?

#includemain(){char ch;clrscr();pritnf("\nEnter any character:");fflush(stdin);scanf("%c",&ch);if (ch 'U' ch = 'u'){printf("\n The entered character %c is Vowel.\n", ch);}else{printf("\nThe entered character %c is not Vowel.\n",ch);}}


How do you type a long vowel?

You will have to go to the Character Map for this. Click Start > All Programs > Accessories > System Tools > Character Map. Then find the long vowel and double click it. It should appear in the "Characters to copy" text box. Click "Copy" and paste it where you want it. An easy way to find the long form of a vowel in Character Map is to check "Advanced view" and type "Macron" in the search box.