vb循环输出语句
y=(3125*x+4149)/1024哪位好心人帮我调试下,这个算式x,y均要为正整数,y为多少数值是最小的,求x,y谢谢...
y = (3125 * x + 4149) / 1024 哪位好心人帮我调试下,这个算式x,y均要为正整数,y为多少数值是最小的,求x, y 谢谢
展开
4个回答
展开全部
Private Sub Command1_Click()
Dim x&
x = 1
Do
If (3125 * x + 4149) Mod 1024 = 0 Then Exit Do
x = x + 1
Loop
Print "x="; x
Print "y="; (3125 * x + 4149) / 1024
End Sub
X=1023 y=3126
Dim x&
x = 1
Do
If (3125 * x + 4149) Mod 1024 = 0 Then Exit Do
x = x + 1
Loop
Print "x="; x
Print "y="; (3125 * x + 4149) / 1024
End Sub
X=1023 y=3126
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Option Explicit
Private Sub Command1_Click()
Dim x As Single, y As Long
Do
y = y + 1
x = (y * 1024 - 4149) / 3125
If Int(x) = x And x >= 0 Then
Print x & " " & y
Exit Do
End If
Loop
End Sub
Private Sub Command1_Click()
Dim x As Single, y As Long
Do
y = y + 1
x = (y * 1024 - 4149) / 3125
If Int(x) = x And x >= 0 Then
Print x & " " & y
Exit Do
End If
Loop
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Sub test()
flag = 0
x = 1
Do While flag = 0
y = (3125 * x + 4149) / 1024
If y = Int(y) Then
MsgBox ("x=" & x & ";y=" & y)
Exit Do
End If
x = x + 1
Loop
End Sub
flag = 0
x = 1
Do While flag = 0
y = (3125 * x + 4149) / 1024
If y = Int(y) Then
MsgBox ("x=" & x & ";y=" & y)
Exit Do
End If
x = x + 1
Loop
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询