Question: Write a C code that reads in a line of arithmetic expression from the console, checks its validity and outputs the result.The code should do

Write a C code that reads in a line of arithmetic expression from the console, checks its validity and outputs the result.The code should do the following:
1. Ask the user to enter a simple arithmetic expression, which should be in the format(a)(op)(b)(=)where:* a,b: integer or floating point number* op: operator (+,-,*,/,%)*_ : space*=: equal to 1.
For each input, the program should validate that it is either an integer or a floating point number.
2. The program should validate for the correct valid operator (+,-,*,/,%).
3. The program should validate that each input is separated by a space.
4. The program should display the result in the following line.The following error checking should be done:
1. If the input contains no errors: "No Error"
2. If the number is not an integer or floating point number: "Parsing Error"
3. If the is no space separating the inputs: "Parsing Error"
4. If the operator is not valid: "Invalid Operator"
5. If the division is by zero: "Division by Zero"
6. If the modulo is by zero: "Modulo Error"
The program should terminate when the console input is "exit". The lab requires the use of loops, iterators and functions.

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