Question: Rewrite the following code replacing the else-if construct with a switch statement. Make sure you test your code. *Apply the requested changes to this code

 Rewrite the following code replacing the else-if construct with a switch

statement. Make sure you test your code. *Apply the requested changes to

this code and'* * turn it in. #include int main(void) char ch;

int countA0 int count = 0; int countI 0 printf ("Enter in

a letter A, E, or I. "); scanf(" %c", &ch); //Replace the

following block with your switch countE++ else if (ch 'A' ch 'a')

Rewrite the following code replacing the else-if construct with a switch statement. Make sure you test your code. *Apply the requested changes to this code and'* * turn it in. #include int main(void) char ch; int countA0 int count = 0; int countI 0 printf ("Enter in a letter A, E, or I. "); scanf(" %c", &ch); //Replace the following block with your switch countE++ else if (ch 'A' ch 'a') countAtt; else if (ch 'I' ch 'i') countI+ else print f ("Error, %c is not an A, E r I. ", ch); //end of your switch return 0 //end main Modify the supplied source code. Add a function with the correct declaration and definition. The function should take the user input and perform the following: If the supplied integer is 10, print the square of the integer, if the integer is 9, divide by 3 and print the result, if the integer is 2 or 3, multiply the integer by 9 and print it out. You should implement this using a nested if statement and not a switch or else-if statement. Add vour function to thiscode and test it #include //function declaration int main (void) int anInt = 10; //call 1 anInt = 9; //call 2 anInt = 2; //call3 //call4 return 0; //end main //Function definition Modify the supplied source code. Add a function with the correct declaration and defnition. The function should take the user input and perform the following: Given an integer between 1 and 12 use a switch statement to determine the month of the year. January would be month 1. Your switch statement should print the correct month. Your function return is void. Insert your function calls to the provided code. Make sure you test your code Add the function t determine the month of the year from the integer 1 - 12 #include //function declaration int main (void) int mnthllbr = 0; do t printf ("Enter in the number of the month from 1 to 12.1n") while (mnthNbr > 12 mnthNbr

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!