关于C++中for循环的问题

刚刚在百度上搜题,发现这样一段代码,其中的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;
}
for(s=n,m--;m;s+=n=sqrt(n),m--);
就是
s = n;
m--;
while (m > 0) //或者说m != 0
{
n=sqrt(n);
s += n;
m--;
}