| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 114895 | 胡海峰老师 | 13分数求和 | C | Compile Error | 0 MS | 0 KB | 249 | 2025-03-24 19:57:42 |
#include <stdio.h> int main() { int a,b; a=2;b=1; float s =a/float(b); int n; scanf("%d",&n); for(int i=2;i<=n;i++) { int top; top =a+b; b = a; a = top; s += a/(float)b; } printf("%.4f",s); return 0; }
Main.c: In function 'main':
Main.c:8:13: error: expected expression before 'float'
float s =a/float(b);
^
Main.c:10:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^