标签:clu style class lan href 文章 tps https target
/* 求解数列1+1/(1+2)+1/(1+2+3)+...... */ #include <stdio.h> double fun(int n){ double s=0; int i,a=0; for(i=1;i<=n;i++){ a=a+i; s=s+1.0/a; } return s; } int main(){ int n; double t; printf("请输入一个正整数n:"); scanf("%d",&n); t=fun(n); printf("当n=%d时,数列的值是%f\n",n,t); return 0; }
收录于文章《885程序设计考点狂背总目录中》
求解数列1+1/(1+2)+1/(1+2+3)+......
标签:clu style class lan href 文章 tps https target
原文地址:https://www.cnblogs.com/byczyz/p/13387039.html