Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!!

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

6. How do histories influence the process of identity formation?

Answered: 1 week ago