Write a program for the following: Assume that your computer has the very limite
ID: 3680995 • Letter: W
Question
Write a program for the following:
Assume that your computer has the very limited capability of being able to read
and write only single-integer digits and to add two integers consisting of one
decimal digit each. Write a program that can read two integers up to 30 digits
each, add these integers together, and display the result. Test your program
using pairs of numbers of varying lengths.
Hint: Store the two numbers in two int arrays of size 30, one digit per array
element. If the number is less than 30 digits in length, enter enough leading
zeros (to the left of the number) to make the number 30 digits long.
You will need a loop to add the digits in corresponding array elements. Don’t
forget to handle the carry digit if there is one!
Make sure you test your program with enough test data.
Hint: Digits from the large integer values should be read in as characters and
then converted to integers one character at a time to be stored in the 31 element
integer array. Since the number is large and you cannot input it as an integer.
Explanation / Answer
Please find the required program :
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.