Question: Write a script to add two 2 0 - digit numbers and print the result. This is not as easy as it might sound at

Write a script to add two 20-digit numbers and print the result. This is not as easy as it might sound at first
because integer types may not be able to store a value this large. One way to handle large integers is to
store them in vectors, where each element in the vector stores a digit of the integer. Your script shoulc
initialize two 20-digit integers, storing each in a vector, and then add these integers, also storing the resul
in a vector. Create the original numbers using the randi function. Hint: add 2 numbers on paper first, anc
pay attention to what you do! For example, by running the code, you will see this in the command window:
4,9,6,6,7,3,5,5,1,5,6,4,8,7,3,4,3,7,7,4
6,9,7,7,1,3,5,4,0,2,8,0,8,0,6,5,2,5,1,6
+
1,1,9,4,3,8,7,0,9,1,8,4,5,6,7,9,9,6,2,9,0
Or
 Write a script to add two 20-digit numbers and print the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!