编写程序1/(1*2)+1/(2*3)+1/(3*4)+...+1/(n(n+1)的值

如题所述

1/(1*2)+1/(2*3)+...+1/(n(n+1))
=1-1/2+1/2-1/3+...+1/n-1/(n+1)
=1-1/(n+1)
下面就编程吧,应该可以很简单编出来了。而且这样不使用循环,可以节约程序占用资源,优化代码结构
温馨提示:内容为网友见解,仅供参考
第1个回答  2008-05-12
//Pascal Program
var i,n:integer;
sum:real;
begin
readln(n);
sum:=0;
for i:=1 to n do
begin
sum:=sum+1/(i*(1+i))
end;
end.

//VB Program
private function Count(n as integer) as double
dim i as integer
count=0

for i=1 to n step 1
count=count+1/(i*(i+1))
next i
end function

//C Program
int count(int n)
{
int i;
double sum;

for (i=0;i++;i=n)
sum=sum+1/(i*(i+1));
return 0;
}

c语言中如何编辑e=1+1\/1*2+1\/2*3+1\/3*4…1\/n*(n+1)
你写的算式是错误的。按你的算式:e=1+1\/(1*2)+1\/(2*3)+1\/(3*4)+...+1\/[n(n+1)]=1+1- 1\/2 +1\/2 -1\/3+1\/3 -1\/4+...+1\/n -1\/(n+1)=2- 1\/(n+1)=(2n+1)\/(n+1)是得不到e的值的。真正的算式是e=1+1\/1!+ 1\/2!+...+1\/n!程序:include <stdio...

1. 编写程序求解S=1\/(1*2)+1\/(2*3)+1\/(3*4)+……+1(n*(n+1))
include <stdlib.h> include <stdio.h> void main ( void ){ int nNum;float fResult = 0.0;printf ( "input the n: " );scanf( "%d", &nNum );printf ( "Calculating...\\n" );while( nNum > 0 ){ fResult = fResult + ( 1 \/ ( float( nNum ) * float( nNum + ...

C语言编程:求1\/1×2+1\/2×3+1\/3×4+……1\/n×(n+1)
其实1\/n*(n+1)=1\/n-1\/(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语言求s=1\/1*2+1\/2*3+...+1\/n(n+1)
给你个小例子参考一下:include <stdio.h> 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;}

sum=1\/(1*2)+1\/(2*3)+...+1\/(n*n+1) n为整数 求n=25时 sum的值
应该是1 \/ (n (n + 1))吧……?由于1 \/ (n (n + 1))= 1 \/ n - 1 \/ (n + 1),所以,sum等于1减去二分之一,再加上二分之一,减去三分之一,再加上……最后当n = 25时,1只减去1 \/26,所以sum是25\/26

1\/1*2+1\/2*3+1\/3*4+...1\/n(n+1)
==n\/n+1。1、可以分析数列的规律:1\/1×2=1-1\/2,1\/2×3=1\/2-1\/3;即每个数字都可以进行拆分为两个分数相减,通项公式为:1\/n(n+1)=1\/n-1\/n+1 2、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。

1\/1*2+1\/2*3+1\/3*4+…+1\/n(n+1)
解:依题意得A1=1\/1*2,A2=1\/2*3...所以 An=1\/n(n+1)An=1\/n(n+1)=1\/n-1\/(n+1)所以A1=1-1\/(1+1)1-1\/2 A2=1\/2-1\/3 A3=1\/3-1\/4 。。。An=1\/n-1\/(n+1)所以1\/1*2+1\/2*3+1\/3*4+…+1\/n(n+1)就等于 A1+A2+A3+...+An= 1-1\/2+1\/2-1\/3+1\/...

1\/1*2+1\/2*3+…+1\/n(n+1) 怎么做?
1\/1*2+1\/2*3+…+1\/n(n+1)=1-1\/2+1\/2-1\/3+...+1\/n-1\/(n+1)=1-1\/(n+1)=n\/(n+1);您好,很高兴为您解答,skyhunter002为您答疑解惑 如果本题有什么不明白可以追问,如果满意记得采纳 如果有其他问题请采纳本题后另发点击向我求助,答题不易,请谅解,谢谢。祝学习进步 ...

1\/(1*2)+2\/(1*2*3)+3\/(1*2*3*4)+...+n\/(1*2*3*...*(n+1))
n\/(1*2*3*...*(n+1)=[1\/n!-1\/(n+1)!]所以原式=1-1\/(n+1)!

相似回答