private sub command1_click()
dim n as integer
dim m as integer
n = trim(text1.text)
m = trim(text2.text)
dim number1() as integer
dim number2() as integer
redim number1(len(n))
redim number2(len(m))
dim index as byte
forindex = 1 to len(n)
number1(index) = mid(n, index, 1)
forindex = 1 to len(m)
numbwe(index) = mid(m, index, 1)
nextindex
dimresult() as byte
redim result(len(n) + len(m))
dimmcarry as byte, acarry as byte
dimi as integer, j as integer
for i = len(m) to 1
for j = len(n) to 1
result(i + j) = (mcarry + (number2(i) * number1(j)) mod 10 + result(i +j)) mod 10
mcarry = (number2(i) + number1(j)) \ 10
next m
result(i) = mcarry + acarry
j= len(n)
mcarry = 0
acarry = 0
end sub
兩位數乘法
option base 1 private sub command1 click dim m as string dim n as string m trim text1.text n trim text2.text dim number1 as byte dim number2 as byte r...
兩位數乘法的速算方法(一)
兩位數乘法的速算方法 一 講的是兩位自然數的相乘,即如何計算abxcd的相乘結果,例如86x32。ab叫被乘數 cd叫乘數 設兩位數分別是10a b,10c d,其乘積為s,根據多項式展開 s 10a b x 10c d 10a x 10c b x 10c 10a x d bxd。所謂速算,就是根據...
兩位數乘法的速算方法(二)
兩位數乘法的速算方法 二 公式推導 10 a a 10b 10 b 100ab 10 a x 10 b ab a 10 b 100ab 100a ab 100a b 1 ab 速算方法 1.乘數首位加1,得出的和與被乘數首位相乘,得數作為前積 2.尾數相乘,得數作為後積,沒有十位用0補 應用舉例 6...