2016 - 2025

感恩一路有你

java用for语句求n的阶乘 vb怎么编写6的阶乘?

浏览量:2703 时间:2023-07-17 23:17:42 作者:采采

vb怎么编写6的阶乘?

语句的实现

Private subcommand 1_Click ()

Dim s is Long, n is integer, and I is integer.

n Val(文本1。正文)

s 1

For i 1 to n

s s * i

Next, I

character string

End joint

2、Do While语句实现

Private subcommand 1_Click ()

Dim s is Long, n is integer, and I is integer.

n Val(文本1。正文)

s 1

I 1

Do it while I;m away

s s * i

Me, me, 1

ring

character string

End joint

扩展数据:

从1到10的阶乘结果如下:

1!一个

2! 2*12

3! 3*2*16

4! 4*3*2*124

5! 5*4*3*2*1120

6! 6*5*4*3*2*1720

7! 7*6*5*4*3*2*15040

8! 8*7*6*5*4*3*2*140320

9! 9*8*7*6*5*4*3*2*1362880

10! 10*9*8*7*6*5*4*3*2*13628800

正文)s 1I 1Do it while I;m aways s * iMe me 1ringcharacter stringEnd joint 阶乘 扩展 Private subcommand 1_Click ()Dim s is Long n is integer and I is integer.n Val 文本

版权声明:本文内容由互联网用户自发贡献,本站不承担相关法律责任.如有侵权/违法内容,本站将立刻删除。