Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

Write an interactive program that adds two integers of up to 50 digits each (Represents integer as an array of digits) with outputs in screen shots and with program explanation.

OpenStudy (e.mccormick):

It would probably be easiest to take in each number as a string. That way the person can type them in as normal things. Then convert each string into the arrays the problem is asking for. Then do the addition. One suggestion: When you go to convert, find out which of the two is longer. Make your integer arrays with that many positions. If you think about what you will be adding, you will realize why.

OpenStudy (theeric):

The array for your sum might even be 51 digits! That's important to note. When you do addition, the sum can be [at most] 1 digit greater than the digits of even the largest of the added numbers. Here are examples with two smaller, one biggest and one smallest, and two biggest. They're not proofs, just cases. 200,000,000 +200,000,000 _____________ 400,000,000 999,999,999 + 1 _______________ 1,000,000,000 999,999,999 +999,999,999 ______________ 1,999,999,998 So, the sum might have one more digit that the number.

OpenStudy (theeric):

Other details depend on how you want to implement (code) it!

OpenStudy (e.mccormick):

Another thing that will make a big change is what language you write it in. Some will be easier than others.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!