Maximum of four numbers
Problem
Write a program that displays the maximum of four integers entered from the keyboard. Use a algorithm to write the program.
ALGORITHM
- Enter the input of four variable values from the keyboard.
- Assign the value of the
M
variable to the first of four variables.
- If the value of the second variable is greater than the value in the
M
variable, then replace the value of the M
variable with the value of the second variable.
- If the value of the third variable is greater than the value in the variable
M
, then replace the value of the M
variable with the value of the third variable.
- If the value of the fourth variable is greater than the value in the variable
M
, then replace the value of the M
variable with the value of the fourth variable.
- Output the value of the
M
variable on the screen.
Following this algorithm, write a program.
Input format
The program receives as input four integers, written on one line, separated by a space.
Output format
Output one number - the maximum number among the entered numbers.
Запрещенные операторы: else
; and
; not