#include void main(){int n,k;double s=0;for(n=1;s<=10;n++){k=n;s+=1.0/n;}printf("%d",k-1);}
运行结果:
int n=1;int Sn = 0;while (Sn <=10){ Sn += 1/n; n++;}printf("N的最大值:%d", n-1);