double f(double x); {double a=0;int i; for (i=0;i
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/22 01:44:03
doublef(doublex);{doublea=0;inti;for(i=0;idoublef(doublex);{doublea=0;inti;for(i=0;idoublef(doublex)
double f(double x); {double a=0;int i; for (i=0;i
double f(double x); {double a=0;int i; for (i=0;i
double f(double x); {double a=0;int i; for (i=0;i
函数f(x)返回x^2 + 1
循环体内 a +=f((double)i) 等价于 a = a + f((double)i) a的初始值为0,所以循环体内的语句是累加f(i).
从for(i = 0; i < 30; i += 10)看出,i的初始值为0,每次递增10,三次递增后达到30,不满足i