编写函数fun 该函数功能是:计算并输出级数1/1×2+1/2×3+1/3×4+……1/n×(n+1)的和 函数fun在主函数中调用 各位大大帮帮忙 鄙人感激不尽
C语言编程:求1\/1×2+1\/2×3+1\/3×4+……1\/n×(n+1)
所以这个函数可以这样写。float fun(float n){ return 1-1\/(n+1);} 主函数中 int main(){ float n;printf("%f\\n",fun(n));return 0;}
用C语言编程计算数学公式s=1\/1*2+1\/2*3+1\/3*4+...1\/n*(n+1)
void main(){ int i, n;float s=0.0;scanf("%d", &n);for (i = 1; i <= n; i ++)s += 1.0\/n\/(n+1);printf("%f\\n", s);}
c语音求1\/1×2+1\/2×3+...+1\/n×n+1知道某一项小于0.001为止编程?
int main(){ float a=0.5;for(int i=2;a>=0.001;i++){ a+=1.0\/(i*(i+1));} printf("answer=%f",a);return 0;}
如何用C语言求s=1\/1*2+1\/2*3+...+1\/n(n+1)
int main(){ int i, n=10;double nSum = 0.0;for (i=1; i<n+1; i++){ nSum += 1.0 \/ (i*1.0*(i+1.0));} printf("%lf\\n", nSum);return 0;}
求助:用C语言编写1+1\/1*2+1\/2*3+...1\/n(n+1),有 那位会的朋友帮帮我啊...
n的值是不确定的吧,那就从键盘输入n的值。include<stdio.h> void main(){ int i,n;float s=0;printf("请输入n的值:");scanf("%d",&n);s=1;for(i=1;i<=n;i++)s=s+1.0\/(i*(i+1));printf("s=%f",s);}
...1\/(1*2) + 1\/(2*3) + 1\/(3*4) +…… + 1\/(n*(n+1))的值
include <stdio.h> float sum(int n){ float s;\/\/s=sum(n);if (n==0){ s=1;} else { s=1.0\/(n*(n+1))+sum(n-1);} return s;} void main(){ int n;float s;scanf("%d",&n);s=sum(n);printf("%f,\\n",s);} 这样改 ...
1\/1*2+1\/2*3+1\/3*4+.1\/n(n+1)
1\/1*2+1\/2*3+1\/3*4+.1\/n(n+1) 您好: 1\/1*2+1\/2*3+1\/3*4+..+1\/n(n+1) =1-1\/2+1\/2-1\/3+1\/3-1\/4+..+1\/n-1\/(n+1) =1-1\/(n+1) =n\/(n+1) 如果本题有什么不明白可以追问,如果满意请点选右下角“采纳为满意回答” 如果有其他问题请采纳本...
C语言题目,编写一个程序,计算公式:y=1+1\/2*2+1\/3*3+1\/4*4+1\/n×n?
题目应该是y=1+1\/2*2+1\/3*3+1\/4*4+……+1\/n×n吧?这个其实好简单的啊。代码如下:include<stdio.h> int main(){ int x;int n;double y=0.00;printf("请输入数值n:");gets(n);for(x=1;x<n;x++){y=y+1\/x*x;} printf("当n=%d时,1+1\/2*2+1\/3*3+1\/4*4+…...
...n)求:1+1\/(1*2)+1\/(2*3)+1\/(3*4)+…+1\/(n*(n+1))的值做为函数返回...
double fun(int n){ cin>>n;double sum;sum=2.0-1.0\/(n+1);cout<<sum<<endl;return sum;} int main(){ int x;cout<<"input"<<endl;fun(x);return 0;} \/\/\/ C版本 include<stdio.h> double fun(int n){ scanf("%d",&n);double sum;sum=2.0-1.0\/(n+1);printf("%lf...
...34 编写程序,求S=1\/(1*2)+1\/(2*3)+1\/(3*4)+……前50项之和。_百度...
include<stdio.h> int main(){int i;float y=0;for(i=1;i<=50;i+=2)y+=1.0\/(i*(i+1));printf("%g\\n",y);return 0;}