Assignment #3 - 86B
Assignment #3 - 86B
Assignment #3
Due: Oct.14 , 1986
Weight: 25 T.A. Bernard Chung
It is frequently necessary to store extremely large integer
numbers. This may be accomplished by storing a 20-digit
integer value in an integer array of length 20, with one
decimal (0 .. 9) stored in each location.
Write a program to read in two 20-digit numbers (on two
consecutive input lines), store them in two arrays, and
generate the sum in another 20-location array. Be sure to
check for posible overflow. This should be repeated for the
20-digit numbers found on the next two input lines, until
the two numbers read are all zeros.
You may assume that all the 20-digit numbers are
non-negative, and that there are no errors in the input.
The input is found in the file INF8:ASS3.DATA
Example of input:
12345678901234567890
12345678901234567890
09876543210987654321
12345678901234567890
54321098765432109876
54321098765432109876
00000000000000000000
00000000000000000000
Your output should look like this:
12345678901234567890 +
12345678901234567890
--------------------
24691357802469135780
--------------------
**********************
09876543210987654321 +
12345678901234567890
--------------------
22222222112222222211
--------------------
**********************
54321098765432109876 +
54321098765432109876
--------------------
OVERFLOW !!!
--------------------