1楼:匿名用户
(n+1)3-(n-1)3=6n2+2
所以du
zhi6×
dao12+2=23-03
6×22+2=33-13
6×32+2=43-23
6×42+2=53-33
....................
6(n-1)2+2=n3-(n-2)3
6n2+2=(n+1)3-(n-1)3
相加版,得
权6(12+22+32+...+n2)=(n+1)3+n3-112+22+32+...+n2=n(n+1)(2n+1)/6
2楼:大牌在握
^^(n+1)^bai2-n^du2=2n+1n^zhi2-(n-1)^2=2(n-1)+1,...dao...
2^2-(2-1)^2=2(2-1)+1
相加便得
版(n+1)^2-(2-1)^2=2[n+(n-1)+......+2+1]+n
故1+2+3+...+n=[(n+1)^2-1-n]/2=n(n+1)/2。权
编写一个vb程序,求 1+1/2+1/3+1/4+......+1/n 的值。(测试数据:n=50 答案:4.50)
3楼:匿名用户
private sub ***mand1_click()print "第3题:";
dim n as integer, s as doublen = inputbox("n=", , 50)for i = 1 to n
s = s + 1 / i
next i
print "sum(" & n & ")="; format(s, "0.00")
end sub
private sub ***mand2_click()print "第4题:";
dim n as integer, s as doublen = inputbox("n=", , 50)for i = 1 to n
s = s + (-1) ^ (i - 1) * (1 / i)next i
print "sum(" & n & ")="; format(s, "0.00")
end sub
private sub ***mand3_click()print "第5题:";
dim n as integer, s as doublen = inputbox("n=", , 20)for i = 1 to n
for j = 1 to i
s = s + j
next j
next i
print "sum(" & n & ")="; send sub
private sub ***mand4_click()print "第6题:";
dim n as integer, s as doublen = inputbox("n=", , 50)for i = 1 to n
if i mod 3 = 0 or i mod 7 = 0 thens = s + i
end if
next i
print "sum(" & n & ")="; send sub
private sub ***mand5_click()print "第7题:";
dim n as integer, s as doublen = inputbox("n=", , 10)s = 1
for i = 1 to n
s = s * i
next i
print n & "!="; s
end sub
4楼:
^^private sub form_click()dim i as integer
dim x as single
for i = 1 to 50
x = x + 1 / i
next
print x
end sub
private sub form_click()dim i as integer
dim x as single
for i = 1 to 50
x = x + (-1) ^ (i - 1) / inext
print x
end sub
函数递归
private sub form_click()print f(50)
end sub
public function f(x as integer) as single
if x > 1 then
f = f(x - 1) + (-1) ^ (x + 1) / xelse
f = 1
end if
end function
vb作业题,编写程序,求s 1 2 3n的值。其中n值
1楼 听不清啊 private sub mand1 click n cint inputbox 求 bain!, du请输zhi 入daon的值 版 s 1 for i 2 to n s s i next i msgbox n 权 s end sub 2楼 匿名用户 private sub form...
C语言编程:求1!+2!+3n!的值
1楼 向雪晴锐捷 include main sum g printf 总和是 d n sum 2楼 听不清啊 include double fun int n int main 这个的时间复杂度为o n 2 3楼 揭蕾完海阳 include intfun int n 求阶 乘 void main 用...
求解答过程:阅读下面的文言文,完
1楼 大神酱团 1 c2 b 3 b4 1 刘秉忠 谈论天下大事就像在手掌中指点着它们一样。 2 刘秉忠 采取祖宗旧有的典章制度,把适宜当时的古代制度加入其中,分条列出来使元世祖知道。 求解答过程 阅读下面的文言文,完 2楼 犯哥 1 c2 a 3 b4 1 如果有不符合实情的,我自当承担罪责,不会...