92,830 views
10 votes
10 votes
Write an algorithm to find addition, subtraction, and multiplication of 2 numbers

User Fedcomp
by
3.3k points

1 Answer

23 votes
23 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 Hauke
by
2.7k points