vb作业题,编写程序,求s 1 2 3n的值。其中n值

2020-12-12 10:46:36 字数 5265 阅读 8299

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_click()dim a as integer, i as integer, s as long

s = 1

a = inputbox("请输

来入自一个

数", "提示", "5")

for i = 1 to a

s = s * i

if i = a then

print str(i) + "=" + str(s)else

print str(i) + "*";

end if

next

end sub

vb作业题,编写程序,求s=1*2*3*…*n的值。其中n值从键盘上输入,在窗体上输出s值。

3楼:才翠花郯丙

private

subform_click()

'注意n的值不能输入太大

,太大会出专现溢出属

错误dimnas

integer,sas

doublen=

val(inputbox("n=?"))s=1fori=

1tons

=s*i

next

imsgbox

"s="&s

endsub

vb编程题设计程序求s=1/2+3!/4+......+(n-1)!/n 的值并输出,其中n是从键盘输入大于1的正整数 5

4楼:听不清啊

照楼主的题目,n不是大于1的正整数,应该是大于回1的正偶数才对答吧?

private sub ***mand1_click()n = val(inputbox("n="))if n mod 2 = 1 then exit subt = 1 / 2

s = t

for i = 3 to n - 1 step 2t = t * i * (i - 1) * (i - 1) / (i + 1)

s = s + t

next i

print s

end sub

5楼:可轩

private sub ***mand1_click()dim j%, k%, n%, m#, s#n = inputbox("n=?")

s = 0

for j = 2 to n

m = 1

for k = 1 to j - 1

m = m * k

next k

s = s + m / j

next j

clsprint "结果是"; s

end sub

6楼:

functionout(n)

fori=1ton

baiout=out+cj(i-1)/i

next

endfunction

functioncj(n)

fori=1ton

cj=n*i

next

endfunction

forn=1to5

text1.text=text1.text&","&out(n)next

随便du写的

zhi 对不对不晓dao得回

你自己答算

7楼:李清尘

privateb,nasintergerprivatefunctionjc(masinterger)asinterger

jc=1

ifm>1then

fori=1tom

jc=jc*i

nexti

endif

endfunction

privatesubtext1_keydown(keycodeasinteger,shiftasinteger)

n=text1.text

ifkeycode=13then

forj=1ton

b=b+jc(j)/j

nextj

endif

msgboxb,vbok+vbinformation,"输出"

endsub

vb题 急求 编程求s=1+2+3+......+n(其中n的值要求用键盘输入)

8楼:匿名用户

昏暗的n作为长

点我只要

n = val(输入框(“请输入一个数字”,“输入号码”))对于i = 1到n

s = s + i ^ 2

msgbox的

9楼:匿名用户

dim n as long

dim i as long

n = val(inputbox("请输入数字 ", "输入数字"))

for i = 1 to n

s = s + i ^ 2

next

msgbox s

10楼:匿名用户

a=0for i := 1 to n dobegin

a := a + i*i;

endshowmessage(a)

vb编程,求s=1*2*3*...n 求详细解答

11楼:网海1书生

s=1for i=2 to n

s=s*i

next

print s

这没什么好解释的,就是个累乘的过程,用的都是最最基本的语句

12楼:落叶l无情

s=1for i=1 to n

s=s*i

next

编程计算s=1*(1+2)*(1+2+3)*......*(1+2+3+...+n),n的值通过inputbox从键盘输入,计算结果在窗体上输出

13楼:

private sub form_click()dim sum, final as doubledim i, j, n as long

n = clng(inputbox("请输copy入bai

一个du整zhi数dao"))

final = 1

for i = 1 to n

sum = 0

for j = 1 to i

sum = sum + j

next j

final = final * sum

next i

print final

end sub

vb程序设计 1、 编程计算s=1/1!+1/2!+1/3!+…..+1/n! ,n的值通过inputbox从键盘输入,计算结果在窗体上输

14楼:

^private sub ***mand1_click()dim i as integer, j as integer, n as integer

dim sum1 as long, sum2 as longn=inputbox("请输入n的值")

sum1 = 0

sum3=1

for i = 1 to n

sum2 = 1

for j = 1 to i

sum2 = sum2 * j

sum3=sum2^(-1)

next j

sum1 = sum1 + sum3

next i

label1.caption = label1.caption + str(sum1)

end sub

需要一个button 和一个lable,结专果在lable上显示属

编写程序求:s=1*2*3*4*………*n。窗体上有一命令按钮,名称为cmd1,单击命令按钮在窗体上输出s的值 5

15楼:匿名用户

private sub cmd1_click()dim n as integer

dim s as double

dim i as integer

n = inputbox("请输入一个不大于170的自然数")s = 1

for i = 1 to n

s = s * i

next i

print "s="; s

end sub

16楼:匿名用户

1.已知s=3是方程3(-3+1) -m(x-1)/4)=2的解 s满足关系式|2n s|=1

2.n=n(n-1)2s

3.例如像用(n+1)s次幂的方法。

4.n=n(n-1)2s=3x3(-1)=m(x-1)/45.s=3x3-1)+m(x-1)/4

vb语句编写s=1*2*3*……*n的值怎么编?

17楼:匿名用户

这个我来帮你吧!!我在vb里写好**再发给你哟!!!!!!!!!!!!!!!!

private sub ***mand1_click()dim n as integer, s as doublen = val(inputbox("enter data n:"))s = 1

for i = 1 to n

s = s * i

next i

print s

end sub

18楼:匿名用户

dim i as integer, s as integers = 1

for i = 1 to n 'n值自己取s = s * i

next

print s

19楼:遗失悳文明

fora=1ton

s=s*a

next

msgboxs

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 用...

c语言编写程序输入正整数n计算,c语言编写程序,输入一个正整数n,计算1+(1/3)+(1/5)+...的前n项之和。求过程

1楼 匿名用户 include int main for i 1 i n i printf sum 3f n sum return 0 示例运行结果 20sum 2 480 2楼 匿名用户 include int main void for int i 0 i printf 数列前 d 项之和为 g...

当m 2,n时,求代数式(2m 3n)(m+n的值

1楼 搜索中 已知m 2 n 1 2 可得 mn 2x1 2 1, m 2 4 n 1 2 1 4 2x4 2x1 3x1 3x1 4 4 1 4 2 1 2 8 2 3 3 4 3 2 10 9 4 7又3 4 或者代数式 2m 3n m n m n 2m 2mn 3mn 3n m n 2m mn...