Question: write a calculator program in C with a menu of 3 options: printf( 1. Mult 2. Div 3. Exit ); get user input from menu(1
write a calculator program in C with a menu of 3 options: printf(" 1. Mult 2. Div 3. Exit "); get user input from menu(1 for Mult, or 2 for Div or 3 for Exit). If user input is invalid, (input==0|| input >3, or input=characters) re-enter until it's correct scanf("%c", &input); User enters two operands n1 or n2, if it's invalid, re-enter until it's correct. scanf("%f %f", &n1, &n2); Also display error message when n1 divide zero (n2=0) Result= n1*n2 or n1/n2 based on user input selection
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
