Conditional operator




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

Write a program for calculating \(y\) according to he formula:
\(\begin{equation*} y(x) = \begin{cases} 0 &\text{x = 0}\\ x^2-x-1 &\text{in other cases} \end{cases} \end{equation*}\)
Input: integer \(x\)
Output\(y\)

Example
Input Output
1 2 1

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: