i need to write a program which deals with functions in c language by prompting
ID: 3631412 • Letter: I
Question
i need to write a program which deals with functions in c language by prompting the user for a mathematical expression. It will then print the result of that expression which will support the following operators–+, -, x, X, *, /, m, and M. m will stand for minimum. M will stand for maximum.i need to declare, define and call the following functions:
// Returns the result of value_1 + value_2
double add(double value_1, double value_2);
// Returns the result of value_1 - value_2
double subtract(double value_1, double value_2);
// Returns the result of value_1 * value_2
double multiply(double value_1, double value_2);
// Returns the result of numerator / denominator
double divide(double numerator, double denominator);
// Returns the minimum number between value_1 and value_2
double minimum(double value_1, double value_2);
// Returns the maximum number between value_1 and value_2
double maximum(double value_1, double value_2);
i need to Use a switch statement when deciding which expression to evaluate
All output will be displayed with 3 digits of precision
3 different operators will be supported for multiplication
No output will occur in the function definitions
When reading the operator in C with scanf you will need to read in a single character. In order to allow for the leading white space, your scanf call should look like
scanf(" %c", &binary_operator);
examples for outputs:
Please enter an expression (ex: 3.23 + 12): 4.3 + 2.7
4.300 + 2.700 = 7.000
Please enter an expression (ex: 3.23 + 12): 2 - 5.8
2.000 - 5.800 = -3.800
Please enter an expression (ex: 3.23 + 12): 19.1 x 2
19.100 x 2.000 = 38.200
Please enter an expression (ex: 3.23 + 12): 20 / 6
20.000 / 6.000 = 3.333
Please enter an expression (ex: 3.23 + 12): 5 h 9
Illegal expression.
Please enter an expression (ex: 3.23 + 12): 4.3 m 1.01
4.300 m 1.010 = 1.010
Please enter an expression (ex: 3.23 + 12): 4.3 M 1.01
4.300 M 1.010 = 4.300