Ask Question
15 October, 23:31

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.

+5
Answers (1)
  1. 16 October, 02:43
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers