题库 信息学奥赛题库 题目列表 要求以下程序的功能是计算:。#include <iostream&...
单选题

要求以下程序的功能是计算:


#include <iostream> using namespace std; int main() { int n; float s; s = 1.0; for(n = 10; n > 1; n--) s = s + 1 / n; cout << s << endl; return 0; }

程序运行后输出结果错误,导致错误结果的程序行是( )。

A.

s = 1.0;

B.

for(n = 10; n > 1; n--)

C.

s = s + 1 / n;

D.

cout << s << endl;

题目信息
选择题 2014年 初赛
-
正确率
0
评论
27
点击