To get an understanding, let's take these basic rules of addition and multiplication:

aWhere a_{0}a_{0}+ b_{0}x b_{0}--- --- c_{1}c_{0}c_{1}c_{0}

In variable a_{0} is a one-digit number.

In variable b_{0} is a one-digit number.

In variable c_{0} is the ones portion of a two-digit number.

In variable c_{1} is the tens portion of a two-digit number.

Let a_{0} = 3 and b_{0} = 4

Add a_{0} and b_{0} and store the result in c_{0}, which is 7 in this case

Since c_{0} is less than 10, then moving the tens digit to the c_{1} variable is not necessary.

Multiply a_{0} and b_{0} and store the result in c_{0}, which is 12 in this case

Since c_{0} is greater than 9, you'll need to move the tens digit to the c_{1} variable.
To do that, assuming that c_{1} is already pre-initialized to zero,
Then, you take the number in c_{0}, and divide it by 10, and leave off the decimal part, then
add the integer portion to c_{1} like this:

c_{1} = c_{1} + INT(c_{0} / 10) (if the "c" array are decimal numbers)

c_{1} = c_{1} + c_{0} \ 10 (if the "c" array are integer numbers)

To remove the tens portion of the number in c_{0},
you can use either method:

c_{0} = c_{0} MOD 10 (which gives the remainder of 2 in this case)

c_{0} = c_{0} - 10 * INT(c_{0} / 10)

c_{0} = c_{0} - 10 * (c_{0} \ 10)

So c_{1} = 1 and c_{0} = 2 for the multiplication problem.

Let's make this harder. Let's use more variables in each array. We're going to use the numbers 65 and 47 for this arrangement:

aWe're putting the "8" in a_{1}a_{0}a_{1}a_{0}+ b_{1}b_{0}x b_{1}b_{0}-------- -------- c_{3}c_{2}c_{1}c_{0}c_{3}c_{2}c_{1}c_{0}

The example is for addition. We're going to store the answer 132 in the array "c" in positions. c

The rules for adding two numbers go like this:

aDoing the computerizd math in these steps: (note that the c array is preinitialized to zero before you add)_{1}a_{0}8 5 + b_{1}b_{0}4 7 -------- c_{1}c_{0}1 2 (c_{0}= a_{0}+ b_{0}, overflow digit from c_{0}goes to c_{1}) c_{2}c_{1}1 3 (c_{1}= a_{1}+ b_{1}+ c_{1}, overflow digit from c_{1}goes to c_{2}) ======== c_{2}c_{1}c_{0}1 3 2 (bring down all the lowermost variables)

cNow lets change gears to Multiplication!_{0}= c_{0}+ a_{0}+ b_{0}12 = 5 + 7 c_{1}= c_{1}+ INT(c_{0}/ 10) 1 = INT(12/10) c_{0}= c_{0}- 10 * INT(c_{0}/ 10) 2 = 12 - 10*INT(12/10) c_{1}= c_{1}+ a_{1}+ b_{1}13 = 1 + 8 + 4 c_{2}= c_{2}+ INT(c_{1}/ 10) 1 = INT(11/10) c_{1}= c_{1}- 10 * INT(c_{1}/ 10) 3 = 13 - 10*INT(13/10)

We're putting
the "8" in a_{1},
the "5" in a_{0},
the "4" in b_{1}, and
the "7" in b_{0}.

The example is for multiplication.
We're going to store the answer 3,995 in the array "c" in positions.
c_{3}, c_{2}, c_{1}, and c_{0}

The rules for multiplying two numbers go like this:

aDoing the computerizd math in these steps: (note that the c array is preinitialized to zero before you add)_{1}a_{0}8 5 * b_{1}b_{0}4 7 -------- c_{1}c_{0}3 5 (c_{0}= a_{0}x b_{0}, overflow digit from c_{0}added to c_{1}) c_{2}c_{1}5 9 (c_{1}= a_{1}x b_{0}+ c_{1}, overflow digit from c_{1}added to c_{2}) c_{2}c_{1}5 29 (c_{1}= a_{0}x b_{1}+ c_{1}, 7 9 overflow from c_{1}added to c_{2}) c_{3}c_{2}3 9 (c_{2}= a_{1}x b_{1}+ c_{2}, overflow digit from c_{2}added to c_{3}) ========= c_{3}c_{2}c_{1}c_{0}3 9 9 5 (bring down all the lowermost variables)

cDoing math with two 3-digit numbers is noticibly harder:_{0}= c_{0}+ a_{0}x b_{0}35 = 0 + 5 x 7 c_{1}= c_{1}+ INT(c_{0}/ 10) 3 = 0 + INT(35/10) c_{0}= c_{0}- 10 * INT(c_{0}/ 10) 5 = 35 - 10*INT(35/10) c_{1}= c_{1}+ a_{1}x b_{0}59 = 3 + 8 x 7 c_{2}= c_{2}+ INT(c_{1}/ 10) 5 = 0 + INT(59/10) c_{1}= c_{1}- 10 * INT(c_{1}/ 10) 9 = 59 - 10*INT(59/10) c_{1}= c_{1}+ a_{0}x b_{1}29 = 9 + 5 x 4 c_{2}= c_{2}+ INT(c_{1}/ 10) 7 = 5 + INT(29/10) c_{1}= c_{1}- 10 * INT(c_{1}/ 10) 9 = 29 - 10*INT(29/10) c_{2}= c_{2}+ a_{1}x b_{1}39 = 7 + 8 x 4 c_{3}= c_{3}+ INT(c_{2}/ 10) 3 = 0 + INT(39/10) c_{2}= c_{2}- 10 * INT(c_{2}/ 10) 9 = 39 - 10*INT(39/10)

aSo we need to simplify the multiplication into a formula. We could multiply and add the numbers in each element in one part and move the overflows to the next elements to the left. The addition formula would be much easier to program._{2}a_{1}a_{0}* b_{2}b_{1}b_{0}--------------- c_{1}c_{0}(c_{0}= c_{0}+ a_{0}x b_{0}) c_{2}c_{1}(c_{1}= c_{1}+ a_{1}x b_{0}) c_{3}c_{2}(c_{2}= c_{2}+ a_{2}x b_{0}) c_{2}c_{1}(c_{1}= c_{1}+ a_{0}x b_{1}) c_{3}c_{2}(c_{2}= c_{2}+ a_{1}x b_{1}) c_{4}c_{3}(c_{3}= c_{3}+ a_{2}x b_{1}) c_{3}c_{2}(c_{2}= c_{2}+ a_{0}x b_{2}) c_{4}c_{3}(c_{3}= c_{3}+ a_{1}x b_{2}) c_{5}c_{4}(c_{4}= c_{4}+ a_{2}x b_{2}) ============= c_{5}c_{4}c_{3}c_{2}c_{1}c_{0}

For the multiplication table:

Dimension a(100), b(100), c(10000) * you may want to use smaller or larger values of array sizes, but be sure that the sizes of arrays a() and b() multiply to the size of array c(). Select number a$ and b$ (we put these in string variables instead of numbers since the numbers can hold up to 8 or 16 significant digits. Break up the digits in a$ and b$ and place each of them into the array elements of a() and b(). The ones digit goes in element 0 for 10To add two really big numbers together, we'll use this program:^{0}, the tens go element 1 for 10^{1}, the hundreds in element 2, 1000's in 3, and so forth. Suppose we can put this complicated thing into a simple loop formula. This is what abc x def looks like when coded straight: c_{0}= c_{0}+ a_{0}x b_{0}c_{1}= c_{1}+ a_{1}x b_{0}c_{2}= c_{2}+ a_{2}x b_{0}c_{1}= c_{1}+ a_{0}x b_{1}c_{2}= c_{2}+ a_{1}x b_{1}c_{3}= c_{3}+ a_{2}x b_{1}c_{2}= c_{2}+ a_{0}x b_{2}c_{3}= c_{3}+ a_{1}x b_{2}c_{4}= c_{4}+ a_{2}x b_{2}In the first third of the program, the b() array stays the same while the other arays increments by one In the second third of the program, the b() array is one higher, and the other arrays increments by one, but where the c() array begins is one higher. In the third third, the b() array is up one more, the c() array begins another one higher. So, let's place the formula in a loop: FOR x = 0 to 2 FOR y = 0 to 2 c(x + y) = c(x + y) + a(x) * b(y) NEXT y NEXT x The length of a$ and b$ varies, so we need to include their provisions: FOR x = 0 to LEN(a$) FOR y = 0 to LEN(b$) c(x + y) = c(x + y) + a(y) * b(x) NEXT y NEXT x What about the overflow digits? c_{1}= c_{1}+ INT(c_{0}/ 10) c_{0}= c_{0}- 10 * INT(c_{0}/ 10) c_{2}= c_{2}+ INT(c_{1}/ 10) c_{1}= c_{1}- 10 * INT(c_{1}/ 10) c_{3}= c_{3}+ INT(c_{2}/ 10) c_{2}= c_{2}- 10 * INT(c_{2}/ 10) Lets try this method. Bear in mind that we need to set the loop to run as many times as there are digits in a$ and b$ combined. CAUTION: Do not reinitialize the c() array to 0! For x = 0 to LEN(a$)+LEN(b$) c(x+1) = c(x+1) + INT(c(x) / 10) c(x) = c(x) - 10 * INT(c(x) / 10) NEXT x

For the addition loop, we go from this: cLet's put the whole program together!_{0}= a_{0}+ b_{0}c_{1}= a_{1}+ b_{1}To this: FOR x = 0 to LEN(a$) + LEN(b$) c(x) = a(x) + b(x) NEXT x

DIM a(100), b(100), c(10000) CLS DO a$ = "": b$ = "" PRINT "INPUT two whole numbers:"; : INPUT a$, b$ FOR x = 0 TO LEN(a$) + LEN(b$): a(x) = 0: b(x) = 0: NEXT x FOR x = 1 TO LEN(a$) a(x - 1) = VAL(MID$(a$, LEN(a$) - x + 1, 1)) NEXT x FOR x = 1 TO LEN(b$) b(x - 1) = VAL(MID$(b$, LEN(b$) - x + 1, 1)) NEXT x ' operation$ = "x" FOR x = 0 TO LEN(a$) + LEN(b$): c(x) = 0: NEXT x FOR x = 0 TO LEN(a$) - 1 FOR y = 0 TO LEN(b$) - 1 c(x + y) = c(x + y) + a(x) * b(y) NEXT y NEXT x FOR x = 0 TO LEN(a$) + LEN(b$) c(x + 1) = c(x + 1) + INT(c(x) / 10) c(x) = c(x) - 10 * INT(c(x) / 10) NEXT x c$ = "" FOR x = (LEN(a$) + LEN(b$)) TO 0 STEP -1 c$ = c$ + LTRIM$(STR$(c(x))) IF LEFT$(c$, 1) = "0" AND x > 0 THEN c$ = "" NEXT x PRINT a$; " x "; b$; " = "; c$ ' operation$ = "+" FOR x = 0 TO LEN(a$) + LEN(b$): c(x) = 0: NEXT x FOR x = 0 TO LEN(a$) + LEN(b$) c(x) = a(x) + b(x) NEXT x FOR x = 0 TO LEN(a$) + LEN(b$) c(x + 1) = c(x + 1) + INT(c(x) / 10) c(x) = c(x) - 10 * INT(c(x) / 10) NEXT x c$ = "" FOR x = LEN(a$) + LEN(b$) TO 0 STEP -1 c$ = c$ + LTRIM$(STR$(c(x))) IF LEFT$(c$, 1) = "0" AND x > 0 THEN c$ = "" NEXT x PRINT a$; " + "; b$; " = "; c$ LOOP

Menu:

Fun With Math-General Stuff Main Page Units and Prefixes Really Big Number Names Numeric Terms Glossary Proposed New Digits For Base 12, 16, 20 Systems Base Names Formulas: Geometry Number Series Perfect Numbers-definition Perfect Numbers Hexadecimal Math Table 0-10 + 0-10 and 0-10 x 0-10 Hex Decimal Integer Conversion Table How To Compute The Square Root Roman Numerals Binary Math Table Roman Numeral Math Tables What's 13 times 7? Prove That 1 = 2 Number Tricks It's Impossible Pi In Your Face Wind Chill Factor Relative Heat Index Computerized Long Form Math Fractional Tables: Addition Fractional Tables: Multiplication

Related:

Fun With Math Fun With Math-General Stuff Fun With Math-All About The Numbers Fun With Math-2-D Addition Tables Fun With Math-2-D Multiplication Tables Fun With Math-Division Tables with Remainders Fun With Math-Powers and Roots of 2 and 3 Fun With Math-n to the kth Power Fun With Math-Perfect Right Angles Fun With Math-Right Angle Addition Tables - 2D Fun With Math-Factorials Fun With Math-Triangulars Fun With Math-Least Common Multiples Fun With Math-Greatest Common Denominator Fun With Math-Prime Numbers Fun With Math-Factors of Each Number Fun With Math-Prime Factors of Each Number Fun With Math-Decimal to Hexadecimal Conversion Fun With Math-Hexadecimal Addition Tables Fun With Math-Hexadecimal Multiplication Tables

Market Zone:

Amazon Electronics Let's Read Books! Hide My IP - Surf Anonymously Data Storage Batteries TV Shows Video Games Groceries Amazon Instant Video Western Movies/TV Smartphones TV Sets Animated Video Science Fiction Music Downloads Cookbooks Comedy Video WiFi Radio Software Website Hosting

TV Zone:

Star Wars Star Trek CSI NCIS Silicon Valley Seinfeld Eight is Enough M*A*S*H Cheers Married...With Children Westworld Game of Thrones Sabrina the Teenage Witch Big Bang Theory Veep Everybody Loves Raymond South Park Doctor Who Batman

Notable:

The Del: Dave's Entertainment Library! Celebrities a2z Hit Song Titles Stuff! Calendars Picture Gallery SDN Media News and More Donate Cash

Footer:

Dave's Fun Stuff Mega Birthdays Contact Webmaster

Fun With Math-General Stuff Main Page Units and Prefixes Really Big Number Names Numeric Terms Glossary Proposed New Digits For Base 12, 16, 20 Systems Base Names Formulas: Geometry Number Series Perfect Numbers-definition Perfect Numbers Hexadecimal Math Table 0-10 + 0-10 and 0-10 x 0-10 Hex Decimal Integer Conversion Table How To Compute The Square Root Roman Numerals Binary Math Table Roman Numeral Math Tables What's 13 times 7? Prove That 1 = 2 Number Tricks It's Impossible Pi In Your Face Wind Chill Factor Relative Heat Index Computerized Long Form Math Fractional Tables: Addition Fractional Tables: Multiplication

Related:

Fun With Math Fun With Math-General Stuff Fun With Math-All About The Numbers Fun With Math-2-D Addition Tables Fun With Math-2-D Multiplication Tables Fun With Math-Division Tables with Remainders Fun With Math-Powers and Roots of 2 and 3 Fun With Math-n to the kth Power Fun With Math-Perfect Right Angles Fun With Math-Right Angle Addition Tables - 2D Fun With Math-Factorials Fun With Math-Triangulars Fun With Math-Least Common Multiples Fun With Math-Greatest Common Denominator Fun With Math-Prime Numbers Fun With Math-Factors of Each Number Fun With Math-Prime Factors of Each Number Fun With Math-Decimal to Hexadecimal Conversion Fun With Math-Hexadecimal Addition Tables Fun With Math-Hexadecimal Multiplication Tables

Market Zone:

Amazon Electronics Let's Read Books! Hide My IP - Surf Anonymously Data Storage Batteries TV Shows Video Games Groceries Amazon Instant Video Western Movies/TV Smartphones TV Sets Animated Video Science Fiction Music Downloads Cookbooks Comedy Video WiFi Radio Software Website Hosting

TV Zone:

Star Wars Star Trek CSI NCIS Silicon Valley Seinfeld Eight is Enough M*A*S*H Cheers Married...With Children Westworld Game of Thrones Sabrina the Teenage Witch Big Bang Theory Veep Everybody Loves Raymond South Park Doctor Who Batman

Notable:

The Del: Dave's Entertainment Library! Celebrities a2z Hit Song Titles Stuff! Calendars Picture Gallery SDN Media News and More Donate Cash

Footer:

Dave's Fun Stuff Mega Birthdays Contact Webmaster