刘志明
1/x+1/y=2/3计算程序
2025-12-20 06:53
阅读:686

程序:

Private Sub CommandButton1_Click()

Dim x As Integer

Dim y As Integer

x = 1

y = 1

l = 2

With Sheet1

.Cells.Clear

.Cells(1, 1) = "x"

.Cells(1, 2) = "y"

For x = 1 To 100

For y = 1 To 100

If 1 / x + 1 / y = 2 / 3 Then

.Cells(l, 1) = x

.Cells(l, 2) = y

l = l + 1

End If

Next y

Next x

End With

End Sub

计算结果:

x y

2 6

3 3

6 2

转载本文请联系原作者获取授权,同时请注明本文来自刘志明科学网博客。

链接地址:https://wap.sciencenet.cn/blog-3556836-1515076.html?mobile=1

收藏

当前推荐数:0
推荐到博客首页
网友评论0 条评论
确定删除指定的回复吗?
确定删除本博文吗?