Question: Write an algorithm and translate it to a C program for a calculator that performs three (3) operations on 1-byte numbers: addition, subtraction, and multiplication.

Write an algorithm and translate it to a C program for a calculator that performs three (3) operations on 1-byte numbers: addition, subtraction, and multiplication. The type of operation performed depends on the input op_code as follows

if op_code=1 the calculator performs addition of the two 1-byte numbers and store the result in Sum

if op_code=2 the calculator performs subtraction of the two 1-byte numbers and store the result in Difference

if op_code=3 the calculator performs multiplication of the two 1-byte numbers and store the result in the PRODH and PRODL

if op_code is not equal to any of these values the system outputs Error=1

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!