...inputbox函数输入。要求用用户自定义过程计算阶乘,组
发布网友
发布时间:2024-07-29 20:01
我来回答
共2个回答
热心网友
时间:2024-08-03 02:10
Public Class Form1
Private Function jc1(ByVal q)
Dim i%, p%
p = 1
For i = 1 To q Step 1
p = p * i
Next
Return p
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim m!, n!, info1$, info2, C!, title$
title = "组合数计算小能手"
info1 = "请输入m的值"
info2 = "请输入n的值"
m = Val(InputBox(info1, title))
n = Val(InputBox(info2, title))
C = jc1(m) / jc1(n) / jc1(m - n)
Label1.Text = "结果是" & " " & C
End Sub
热心网友
时间:2024-08-03 02:10
Private Sub Command1_Click() Dim m As Integer Dim n As Integer Dim y As Integer m = Val(InputBox("输入m")) n = Val(InputBox("输入n")) MsgBox "m和n最大公约数是:" & yue(m, n) End Sub