Conditional operator




Using as an example the program from the task "Incomplete conditional operator" to search for the maximum of two numbers, write a program that will output the maximum value of four numbers.

You will be given a hint in the form of a verbal algorithm.

Task
Time limit: 1000 ms,
Memory limit: 32 Mb

Write a program that displays the maximum of four integers entered from the keyboard.
Use a verbal algorithm to write the program.
Before writing a program, it is necessary to determine what data we will have input (that is, given and will be entered from the keyboard) and what data will be output (that is, present the result and will be displayed on the screen as an answer)

In our task
Input: four integers separated by space
Output: one number, the maximum of the entered

ALGORITHM
1. Enter the input of four variable values ??from the keyboard
2. Assign the value of the \(M\) variable to the first of four variables
3. 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
4. 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
5. 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
6. Output the value of the \(M\) variable on the screen.

Following this algorithm, write a program.
Prohibited statements:else;and;not;max

Auto CHOOSE THE PROGRAMMING NECESSARY LANGUAGE!
Attach the program source file:
or enter the source code in the language:

Rules for designing programs and a list of errors during automatic task verification
           

Results: