Question: HELP PLEASE!!!! The expected result is shown beneath the question. I attempted it and it's not doing what I want and it's very frustrating. THUMBS
HELP PLEASE!!!! The expected result is shown beneath the question. I attempted it and it's not doing what I want and it's very frustrating. THUMBS UP WILL BE GIVEN IF ANYONE CAN HELP ME GET IT RIGHT. THANKS!!



Edit the code above or write a new code to use a for-loop (that runs 5 times) to ask the user for a math operation as input (, , * , / ). Use an input statement such as ch- getchar0: or scanf("%c ", &ch), to replace the assignment statement ch-w in the code above. Expected result shown in figure below. Submit the revised program as hw01q2_2.c 2.2 [8 points] Enter math operation: + f-30 Enter math operation: - f = -10 Enter math operation: / f-0.5 Enter math operation: f200 nter math operation: invalid operator kbagewad@general2:~/cse240$ Note, you may need to use a fflush(stdin) or a getchar(); to flush the newline character left behind by a previous operation getchar(): case :*': f - a * b; printf( "f-%d ", f); case '/': f- a / b; printf("f-%d ", f); default: printf("invalid operator "); printf("ch-%c ", ch); switch (ch) case '+': f- a + b; printf("f-%d ", case '-': f- a - b; printf("f-%d ", case '"': f- a * b; printf("f-%d ", case ./. : f- a / b; printf( "f-%d ", default: printf("invalid operator "); f); f); f); f); ch - '%"; printf("ch-%c ", ch); switch (ch) ( case '+': f- a + b; printf("f-%d ", case '-': f- a - b; printf("f-%d ", case .*.. f- a * b; printf("f-%d ", case '/': f- a / b; printf("f-%d ", default: printf("invalid operator ") f); f); f); f)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
