What value will be output when the following program segment is executed?int k,sum = 0;for (k = 0; k

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 10:38:31
Whatvaluewillbeoutputwhenthefollowingprogramsegmentisexecuted?intk,sum=0;for(k=0;kWhatvaluewillbeout

What value will be output when the following program segment is executed?int k,sum = 0;for (k = 0; k
What value will be output when the following program segment is executed?
int k,sum = 0;
for (k = 0; k

What value will be output when the following program segment is executed?int k,sum = 0;for (k = 0; k
got a little confused, in the function sum=sum+k, if sum be a constant, the answer
(b) should be right, if the sum is a variable like k, answer (a) is right, program will run 6 times, it's more reasonable.