Ask Question

Write pseudocode for a program which will ask a user to enter two numbers a and b. It then asks what operation is to be performed: a*b, a/b, a//b or a%b, performs the appropriate calculation and prints out the result. If the user does not enter a valid response, print an error message.

+1
Answers (1)
  1. 5 April, 12:49
    0
    get int input for a

    get int input for b

    get string input for operator

    if a is not int or b is not int throw exception and print error

    if operator is not * / / / or % throw exception and print error

    if operator is * do multiplication of a and b and make answer c

    else if operator is / do division of a and b and make answer c

    else if operator is / / do floor division of a and b and make answer c

    else if operator is % do floor modulo of a and b and make answer c

    print c
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write pseudocode for a program which will ask a user to enter two numbers a and b. It then asks what operation is to be performed: a*b, ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers