Use a switch statement to write a function that returns TRUE if a character is a...

Free

60.1K

Verified Solution

Question

Electrical Engineering

Use a switch statement to write a function that returns TRUE ifa character is a consonant and returns FALSE otherwise.

Answer & Explanation Solved by verified expert
4.0 Ratings (689 Votes)

I have tested this program in my code block, it is working fine.


#include
char choice;
void main( )
{
while(1){
        /* Printing the available options */
        printf(\"Enter an alphabet\n\");


        /* Taking users input */
        scanf(\"%c\", &choice);

        switch(choice)
        {
            case 'a':
                printf(\"FALSE\");
                break;
            

            case 'e':
                printf(\"FALSE\");
                break;
            

            case 'i':
                printf(\"FALSE\");
                break;
            

            case 'o':
                printf(\"FALSE\");
                break;
           

            case 'u':
                printf(\"FALSE\");
                break;
         

            default:
                printf(\"TRUE\n\");
    }
scanf(\"%c\", &choice);
}

}


Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students