Please Put in PHP code. Thank you. Design an algorithm that will read two number
ID: 3559605 • Letter: P
Question
Please Put in PHP code. Thank you.
Design an algorithm that will read two numbers and an integer code from the screen. The value of the integer code should be 1, 2, 3, or 4. If the value of the code is 1, compute the sum of the two numbers. If the code is 2, compute the difference (first minus second). If the code is 3, compute the product of the two numbers. If the code is 4, and the second number is not zero, compute the quotient (first divided by second). If the code is not equal to 1, 2, 3 or 4, display an error message. The program is then to display the two numbers, the integer code and the computed result to the screen.
Calculate_result
Prompt for number_1, number_2, code
Get number_1, number_2, code
Set message to blank, calculated_result
CASE of code
calculated_result = number_1 + number_2
calculated_result = number_1 - number_2
calculated_result = number_1 * number_2
IF number_2 NOT = zero THEN
calculated_result = number_1 / number_2
ENDIF
other: message = You enter invalid integer code
ENDCASE
IF message = blank THEN
Display number_1, number_2, code, result
ELSE
Display number_1, number_2, code, message
ENDIF
END
Explanation / Answer
contact on timacs12@gmail.com