1-1/2+1/3-.....-1/10
来源:百度知道 编辑:UC知道 时间:2024/05/04 19:50:55
用do while / for next /do until三种形式分别做出这道题..大家帮忙...谢谢
你没说是什么编程语言,不过看语法应该是vb的
showtomorrow写的似乎是c语言,不过忘了声明变量类型
ZHRX写的肯定不对啊,for怎么能跟end if连用,而且while后边漏了括号
应该是
Dim i As Integer
Dim result As Double
i = 1
result = 0
Do While (i <= 10)
result = result + 1 / i * (-1) ^ (i + 1)
i = i + 1
Loop
Dim i As Integer
Dim result As Double
result = 0
For i = 1 To 10
result = result + 1 / i * (-1) ^ (i + 1)
Next i
Dim i As Integer
Dim result As Double
i = 1
result = 0
Do Until (i > 10)
result = result + 1 / i * (-1) ^ (i + 1)
i = i + 1
Loop
这三种方法结果即是result,输出即可
你问的题不太明白??
i=1,n=1,s=0;
do{
s=s+i/n;
i=-i;
n=n+1;
}while(n<=10)
刚学,只会大致的思想,不会具体的编写。
for t=1 to 10
x=x+(-1)^(t+1)*1/t
end if
do while t<=10
t=t+1
x=x+(-1)^(t+1)*1/t
loop
(1/2005-1)(1/2004-1)........(1/3-1)(1/2-1)
1+1/2+1/3+.....+1/n
1+1/2+1/3+...+1/100
1-1/2+1/3-.....-1/10
(1+1/2+1/3+1/4)×
(1-1/2)(1-1/3)(1-1/4)(1-1/5).....(1-1/1000)
1+1/(1+2)+1/(1+2+3)+...+1/(1+2+3+...+100)
1+1/(1+2)+1/(1+2+3)+-------+1/(1+2+3+----+100)
1+1/1+2+1/1+2+3+...+1/1+2+3...+2000
1+1/1+2+1/1+2+3.........+1/1+2+3.....100