C program: complete the calculator function to make the main program work
\n"); printf("Enter any number twice to quit! \n"); return 0.0f; printf(">> "); } scanf("%f%c%f", &left, &op, &right); printf("Your input is %f %c %f \n", left, op, right); float subtract(float left, float right) { switch (op) { // +, -, *, /, ^ case '+': /* YOUR CODE HERE */ printf("The result is %0.2f\n", add(left, right)); return 0.0f; break; case '-': printf("The result is %0.2f\n", subtract(left, right)); break; float multiply(float left, float right) { /* YOUR CODE HERE */ case '*': printf("The result is %0.2f\n", multiply(left, right)); return 0.0f; break; case '/': printf("The result is %0.2f\n", divide(left, right)); break; float divide(float left, float right) { /* YOUR CODE HERE */ case '^': printf("The result is %0.2f\n", (float) power((int) left, (int) right)); return 0.0f; break; default: puts ("Invalid Operand!"); int power(int base, int exponent) { isvalid = e: /* YOUR CODE HERE */ } return 0; } while (isvalid); } printf("Exiting...bye!"); return e; "/>
Extracted text: Calculator functions Main int main() { #include "calculator.h" float left, right; char op; int isvalid = 1; float add(float left, float right) { do { /* YOUR CODE HERE */ printf("Enter a mathematical expression
\n"); printf("Enter any number twice to quit! \n"); return 0.0f; printf(">> "); } scanf("%f%c%f", &left, &op, &right); printf("Your input is %f %c %f \n", left, op, right); float subtract(float left, float right) { switch (op) { // +, -, *, /, ^ case '+': /* YOUR CODE HERE */ printf("The result is %0.2f\n", add(left, right)); return 0.0f; break; case '-': printf("The result is %0.2f\n", subtract(left, right)); break; float multiply(float left, float right) { /* YOUR CODE HERE */ case '*': printf("The result is %0.2f\n", multiply(left, right)); return 0.0f; break; case '/': printf("The result is %0.2f\n", divide(left, right)); break; float divide(float left, float right) { /* YOUR CODE HERE */ case '^': printf("The result is %0.2f\n", (float) power((int) left, (int) right)); return 0.0f; break; default: puts ("Invalid Operand!"); int power(int base, int exponent) { isvalid = e: /* YOUR CODE HERE */ } return 0; } while (isvalid); } printf("Exiting...bye!"); return e;