VB编程实现计算 s=1+1/2! +1/3! +…+1/n!,直到1/n!小于0.00001为止

如题所述

第1个回答  2013-04-05
Private Sub Form_click() Dim s As Single, a As Single
Dim i As Integer
a = 1
s = 1
i = 1
While a >= 0.00001
i = i + 1
a = a * 1 / i
s = s + a
Wend
Print "s="; s - a
End Sub
第2个回答  2011-03-24
s=0;v=1;
for n=1 to 100000 step 1
v=v*n
s=s+1/v
next n
第3个回答  2011-03-24
j = 1
mul = 1
s1 = 1
do until
for i = 1 to j
mul = mul*i
next i
s1 = 1/mul
if s1<0.00001 then exit do
sum = sum + s1
j = j+1
loop

C语言编程:e=1+1\/!+1\/2!+1\/3!+……+1\/n! 要求用递推解决。两项之差小 ...
假设第 i 项为 t,则第 i+1 项为 t\/(i+1):include<stdio.h> main(){ int i=2;float t0=1,t=1.0\/2,e=2;while(t0-t>0.00001){ t0=t;e+=t0;i++;t\/=i;} printf("\\n%8.6f\\n",e);}

C语言编程:e=1+1\/!+1\/2!+1\/3!+……+1\/n! 要求用递推解决。两项之差小 ...
搜一下:C语言编程:e=1+1\/!+1\/2!+1\/3!+……+1\/n!要求用递推解决。两项之差小于0.0

c++用公式求ex=1+x+x2\/2!+x3\/3!+…+xn\/n!
float s=1,t=1;int i;for(i=1;t<0.00001;i++){ t*=1.0*x\/i;s+=t;}

一道C语言题, 计算1 + 1\/1!+1\/2!+1\/3!+...+1\/n!.帮忙改下程序
include<stdio.h> \/\/一道C语言题, 计算1 + 1\/1!+1\/2!+1\/3!+...+1\/n!.include<math.h> aa ( int n){ if(n==1L)return 1.0;else return (n*aa(n-1));} void main(){ int x;float sum=1,y;scanf("%d",&x);for(int i=1;i<=x;i++){ sum=sum+1.0\/(y...

求S=1-1\/2+1\/3-1\/4+...的值,直到最后一项不小于0.00001
回答如上,你可以用C++编程试试 其实这是ln(x+1)在x=0泰勒展开式

...的绝对值小于0.00001为止. 1+ 1\/3 +1\/5 +1\/7 1
include <stdio.h>int main() { double s = 0.0; int n = 1; double t = 1.0\/n; while (t<0.00001) { s+=t; n+=2; t = 1.0\/n; } printf("%.6f\\n", s); return 0;}

...计算下列公式的值,S=1+1\/1!+1\/2!+1\/3!+….+1+N!,四舍五入到第四位...
1.7183 1\/0.00001=100000 100000\/2=50000 50000\/3=16667 16667\/4=4167 4167\/5=833 833\/6=139 139\/7=20 20\/8=2.5 9!=362880>100000 所以,9!之后的数可以省略 即:求S=1+1\/1!+1\/2!+1\/3!+….+1\/9!≈1.7183

求:C语言编程 求自然数e=1+1\/2!+1\/3!+...1\/n!的近似值,控制第n项的值...
include<stdio.h> void main(){ double e=0;int n=m=1; \/\/m=n!while(1\/m>0.00001){ e=e+1\/m;n++;m=m*n; \/\/n!的表达式 }

...\/2*2+1\/3*3+...+1\/n*n 求P值 要求误差小于0.00001
include <stdio.h>int main(){int n=1;double P=0,e;do {e=1.0\/(n*n) ;P += e ;n++;} while( e >= 1e-5 );printf("%lf\\n", P );return 0;}

C语言编程1+1\/1!+1\/3!+1\/5!...+1\/n!直到n<10^-5
我就当1\/n!<10^-5了。也就相当于n是奇数而且n!>10^5为止。由于这么多小数的计算不好精确实现,可以把式子改写为:(1+1\/1!+1\/3!+1\/5!...+1)*n!\/n!即 (n*...1+n*...*2+n*...*4+n*...*6+...+n+1) \/n!,先求出 S=n*...1+n*...*2+n*...*4+n*......

相似回答