2956: 2012年上半年浙江省高等学校计算机等级考试-编程题2
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:2
Solved:2
Description
按下面要求编写程序:
(1)定义函数fun(x)计算x2-3.14x-6,函数返回值类型是double。
(2)输出一张函数表(如下表所示),x的取值范围是[-10,+10],每次增加 1,y = x2-3.14x-6。要求调用函数fun(x)计算x2-3.14x-6。
x |
y |
-10 |
125.40 |
-9 |
103.26 |
... |
|
9 |
46.74 |
10 |
62.60 |
Output
x前有空格,xy直接用制表符分割,y保留两位小数
Sample Input Copy
没有输入
Sample Output Copy
x y
-10 125.40
-9 103.26
-8 83.12
-7 64.98
-6 48.84
-5 34.70
-4 22.56
-3 12.42
-2 4.28
-1 -1.86
0 -6.00
1 -8.14
2 -8.28
3 -6.42
4 -2.56
5 3.30
6 11.16
7 21.02
8 32.88
9 46.74
10 62.60