Question: There are 4 bugs in the following code. Debug the code. # include int main() { char operator; double Number1 Number2; printf(Please enter an operator

There are 4 bugs in the following code. Debug the code.

# include

int main() {

char operator; double Number1 Number2;

printf("Please enter an operator (+, -, *, /): "); scanf("%c", &operator);

printf("Plaese nnter two operands: "); scanf("%lf %lf",&Number1, &Number2);

switch(operator) { case '+': printf("%.1lf + %.1lf = %.1lf",Number, Number2, Number1+Number2); break;

case '-': print("%.1lf - %.1lf = %.1lf",Number1, Number2, Number1-Number2) break;

case '*': printf("%.1lf * %.1lf = %.1lf",Number1, Number2, Number1*Number2); break;

case '/': printf("%.1lf / %.1lf = %.1lf",Number1, Number2, Number1/Number1); break;

// operator is doesn't match any case constant (+, -, *, /) default: printf("Error! operator is not correct"); }

return 0; }

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