vbs解答一道初中數學題i,x,y

來源:互聯網
上載者:User

一道初中數學題,用VBS找到答案
未知數~i 加上100成為一個完全平方數~X,i 加上168成為另外一個完全平方數~Y,i,x,y都是正整數,求出i,x,y
---------------------------------------------------
n=0
msg1="未知數~i 加上100成為一個完全平方數~X"+chr(10)
msg2="i 加上168成為另外一個完全平方數~Y"+chr(10)+"i,x,y都是正整數"+chr(10)
l=inputbox (msg1+msg2+"請輸入i的搜尋範圍,用來找到i,x,y.1~?:")
if IsNumeric(l) then
msg4=l+" 中搜尋答案"
for i=1 to l
x=int(sqr(i+100))
y=int(sqr(i+168))
if x^2=i+100 and y^2=i+168 then
msg3="那麼 i,X,Y分別是:"+cstr(i)+","+cstr(x)+","+cstr(y)
msgbox msg1+msg2+msg3,vbokonly,msg4
n=1
exit for
end if
next
if n=0 then
msg3="那麼 沒有找到合適的答案!"
msgbox msg1+msg2+msg3,vbokonly, msg4
end if
else
msg3="那麼 沒有找到合適的答案!"
msgbox msg1+msg2+msg3,vbokonly, "搜尋範圍有問題!"
end if

-------------------------------
結論是156,16,18

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.