Input | Process | Output |
---|---|---|
Two numbers (num1, num2) and the operation (add, subtract, multiply, divide) | 1. Accept the two numbers and the operation. | The result of the selected operation. |
2. Perform the selected operation based on user input: | ||
– If addition, result=num1+num2 | ||
– If subtraction, result=num1−num2 | ||
– If multiplication, result=num1×num2 | ||
– If division, result=num1/num2, provided num2 is not 0 |
Explanation:
- The input consists of two numbers and the selected operation.
- The process involves checking which operation the user has selected and performing the corresponding arithmetic operation.
- The output will display the result of the operation.
Example:
For num1 = 6 and num2 = 3, if the operation is multiplication, the output would be 18.