刚刚在百度上搜题,发现这样一段代码,其中的for循环的应用实在是高深莫测,希望前辈可以指点迷津,解释一下这样使用for循环语句的作用,不胜感激
#include "stdio.h"
#include "math.h"
int main(int argv,char *argc[]){
double n,s;
int m;
printf("Input n & m(int 0<n<10000 & 0<m<1000,other end)...\n");
while(scanf("%lf%d",&n,&m)==2 && n>0 && n<10000 && m>0 && m<1000){
for(s=n,m--;m;s+=n=sqrt(n),m--);
printf("%.2f\n\n",s);
}
return 0;
}