#t9. 符号函数计算
符号函数计算
Sign Function
Problem Description
For any integer , the sign function is defined as follows:
- when ;
- when ;
- when .
Write a program to compute this function's value for any integer read in.
Input Format
A single line containing an integer .
Output Format
Output on one line, in the format sign(n) = value, the function value of the integer .
Sample Input 1
5
Sample Output 1
sign(5)=1
Sample Input 2
0
Sample Output 2
sign(0)=0
Sample Input 3
-3
Sample Output 3
sign(-3)=-1
Constraints
Hint
- The definition of sign is given in the statement; just pick one of the three cases.
- The output format
sign(5)=1is assembled — check the parentheses, the equals sign, and the minus sign character by character against the samples.
相关
在以下作业中: