游客 Signup | Login
中文 | En

1141 - C语言5.3

有一个函数:

<span style="font-family:宋体;">给定</span><span>x</span><span style="font-family:宋体;">值,输出对应的</span><span>y</span><span style="font-family:宋体;">值。</span>

<span></span>

Input

一个整数x。

Output

输出x值对应的y值。

请注意行尾输出换行。

Examples

Input

12

Output

1

Solution C

#include<stdio.h>
int main(){
int x,y;
scanf("%d",&x);
if(x<0)
  y=-1;
else if(x==0)
  y=0;
else
  y=1;   
printf("%d\n",y);
return 0;
}

Solution C++

#include <stdio.h>
int main() {
	int x, y;
	scanf("%d", &x);
	if (x < 0)
		y = -1;
	else if (x == 0)
		y = 0;
	else if (x > 0)
		y = 1;
	printf("%d\n", y);
	return 0;
}

Time Limit 1 second
Memory Limit 32 MB
Discuss Stats
上一题 下一题