使用VB.NET编写一个程序 25
使用一根长度为Lcm的铁丝,制作一个面积为S的矩形框,要求计算出满足这种条件的矩形的高h和宽w。...
使用一根长度为Lcm的铁丝,制作一个面积为S的矩形框,要求计算出满足这种条件的矩形的高h和宽w。
展开
2个回答
展开全部
Dim L As Integer = 10
Dim S As Integer = 3
For i = 0 To L
If i > L / 2 Then
Exit For
End If
If i * (L - i) = S Then
MsgBox("长:" + CStr(L - i) + vbCrLf + "宽:" + CStr(i))
End If
Next
Dim S As Integer = 3
For i = 0 To L
If i > L / 2 Then
Exit For
End If
If i * (L - i) = S Then
MsgBox("长:" + CStr(L - i) + vbCrLf + "宽:" + CStr(i))
End If
Next
更多追问追答
追问
h 和w在哪里?
追答
H就是长= L - i
W就是宽 = i
展开全部
Dim intL As Integer = 0
Dim intS As Integer = 0
Dim intH As Integer = 0
Dim intW As Integer = 0
intL = me.textbox1.text
intS = me.textbox2.text
For inti As Integer = 0 To intL/2
IF inti * (intL - inti) = intS Then
IF inti < (intL - inti) then
intH = inti
intW = intL - inti
ELSE
intW = inti
intH = intL - inti
END IF
END IF
NEXT
Dim intS As Integer = 0
Dim intH As Integer = 0
Dim intW As Integer = 0
intL = me.textbox1.text
intS = me.textbox2.text
For inti As Integer = 0 To intL/2
IF inti * (intL - inti) = intS Then
IF inti < (intL - inti) then
intH = inti
intW = intL - inti
ELSE
intW = inti
intH = intL - inti
END IF
END IF
NEXT
追问
拜托自已试过可以再写答案好吗?
追答
我远程都给你写了得了?脑残吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询