How to do a dry run for menu driven program?
Answers
Answered by
1
Answer:
MARK ME AS BRAINIEST
Explanation:
Logic
We use a switch case in order to choose a operation.Then we just put simple math formulae for addition, subtraction, multiplication and divsion.For division, we keep in mind that if the denominator is 0 then it should print as an error.The do while loop is used for repetitive asking the user till he does not wish to exit.
Dry Run of the Program
Take input ‘num1’ and ‘num2’.Let num1=3 and num2=4
We enter do while loop
We choose option 1
switch(option) i.e. switch(1)
case 1: we add and print num1+num2;
then break;
while(option!=5) i.e.(1!=5)
We again enter the do while loop
We choose option 5
if(option==5) break;
So we exit the do while loop
Answered by
0
Answer:
yaa. speakers and i don't know if u will get back
Similar questions