140k views
5 votes
Write an algorithm to find addition, subtraction, and multiplication of 2 numbers

User Rottitime
by
7.1k points

1 Answer

2 votes

Answer:

Addition

Step 1: Input the two numbers, a and b.

Step 2: Output a + b.

Step 3: Output a - b.

Step 4: Output a * b.

Step 5: If b = 0 output “undefined”.

Step 6: Else output a / b.

subtraction

Step 1 If ( a < b ) then there will be no answer .

step 2f ( a = b ) then all the numbers greater than a are the answer so there will be infinite solutions possible.

Step 3 If ( a > b ) Suppose x is an answer to our equation. Then x divides (a – b).

User Gezhonglunta
by
7.0k points