1樓:
private sub command1_click()for i = 1 to 30
for j = i + 1 to 30
k = int(sqr(j * j - i * i + 0.5))if i * i + k * k = j * j and k > i then
print i; k; j
end if
next j, i
end sub
vb編寫勾股定理滿足條件一
2樓:匿名使用者
private sub cmdcal_click()dim i as integer
dim j as integer
dim k as integer
dim n as integer
n = 0
for i = 1 to 60
for j = i to 60
for k = j + 1 to 60
if i ^ 2 + j ^ 2 = k ^ 2 thenn = n + 1
end if
next k
next j
next i
lbl1.caption = n
end sub
3樓:
private sub commandbutton1_click()dim a, b, c as integerdim n as integer
n = 0
for a = 1 to 60
for b = a to 60
for c = 1 to 60
if a ^ 2 + b ^ 2 = c ^ 2 thendebug.print a, b, c
n = n + 1
end if
next c
next b
next a
textbox1.text = n
end sub
vb編寫程式,輸出30以內滿足勾股定理的整陣列合 使用子程式
4樓:設計營地
private sub command1_click()
dim i as integer, j as integer, k as integer
for i = 1 to 30
for j = i to 30
for k = j to 30
if g(i, j, k) then print i; ; j; ; k
next
next
next
end sub
public function g(x as integer, y as integer, z as integer) as boolean
if x ^ 2 + y ^ 2 = z ^ 2 then g = true
if x ^ 2 + z ^ 2 = y ^ 2 then g = true
if z ^ 2 + y ^ 2 = x ^ 2 then g = true
end function
急求vb勾股定理程式設計
5樓:匿名使用者
sub command1_click()
dim i as integer, j as integer, k as integer, x as integer, y as integer
for i = 1 to 30
for j = 1 to 30
for k = 1 to 30
x = i * i + j * j
y = k * k
if x = y then debug.print i, j, knext k
next j
next i
end sub
6樓:匿名使用者
private sub command1_click()for a = 1 to 30
for b = 1 to 30
for c = 1 to 30
if a * a + b * b = c * c then msgbox "三條邊分別是:" & a & "," & b & "," & c
next
next
next
end sub
7樓:匿名使用者
1樓的回答基本可以,但從程式執行資源的角度來看,修改一個會好一些(假如不是30以內,而是30000以內則更明顯)
for i = 1 to 30
for j = i to 30
for k = j*j to 30
x = i * i + j * j
y = k * k
if x = y then
debug.print i, j, k
exit for
end if
next k
next j
next i
求勾股定理程式,vb語言的
求勾股定理vb編碼?如何解釋?
8樓:匿名使用者
1.變數i從1開始,到349結束。
2.變數j從1開始,到349結束。
3.變數k從1開始,到349結束。
4.條件語句:如果i的平方等於j的平方加k的平方,那麼5.列表框新增ijk的值,(以i的平方等於j的平方加k的平方形式)。
6.(條件語句結束。)
7.下一個k (即執行k=k+1,在轉到行3執行。)8.下一個j (即執行j=j+1,在轉到行2執行。)9.下一個i (即執行i=i+1,在轉到行1執行。)
vb編寫關機程式
1全部glngwhichwindows32 mlngwindowsnt是對系統平臺作判斷,是否為nt系統 nt系統下使用adjusttoken獲得許可權驗證 shutdown 使用參shutdown 用法 shutdown i l s r a f m computername t xx c co m...
vb編寫關於階乘的程式,vb編寫一個關於階乘的程式,
來不及寫,教你怎麼做吧 先把文字框的讀取轉存成整數 對這個整數用if判斷 不滿足條件用msgbox提示 滿足條件的話,呼叫函式,引數就是那個整數,返回值就是結果。剛給你寫的 希望對你有幫助 給個滿意回答吧private sub command1 click dim dat1 as variant d...
用VB編寫自動關機程式,用VB編寫一個自動關機程式
option explicit private declare function getlastinputinfo lib user32 plii as lastinputinfo as boolean private declare function gettickcount lib kernel...