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 should initialize two 20-digit integers, storing each in a vector, and then add these integers, also storing the result in a vector. Create the original numbers using the randi function. Hint: add 2 numbers on paper first, and pay attention to what you do! For example, by running the code, you will see this in the command window: + 1 01 496 6 7 69 7 7 1 3 5 5 3 5 4 1 HO 5 6 2 8 4 0 8 7 8 0 ∞ 3 6 ett 4 5 3 2 7 5 7 4 1 6 194 3 8 7 0 9 1 8 4 5 6 7 9 9 6 2 9 0

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
please answer in matlab
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 should
initialize two 20-digit integers, storing each in a vector, and then add these integers, also storing the result
in a vector. Create the original numbers using the randi function. Hint: add 2 numbers on paper first, and
pay attention to what you do! For example, by running the code, you will see this in the command window:
+
Or
496 6 7
9 7
+
6
43
300
3 5 5 1
w w
7 1 3 5
10 St
5 2 0 4
8 8
4
3
6
4 0
1 0
9
5
2
9
9 5
6
8
4
3
40
8
8
9
8 4 9
7 0
7
OL
1
1 9 4 3 8 7 0 9 1 8 4 5 6 7 9 9 6 290
36
160
7
SH
5
4
3
N W
5 2
6
7
7
5
7 4
1
6
5 2
1
7
3 1 3
W N
W N
082 3 6 4 1 1 0 4 8 8 1 9 7 3 3 6 5 8
5
с
Transcribed Image Text: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 should initialize two 20-digit integers, storing each in a vector, and then add these integers, also storing the result in a vector. Create the original numbers using the randi function. Hint: add 2 numbers on paper first, and pay attention to what you do! For example, by running the code, you will see this in the command window: + Or 496 6 7 9 7 + 6 43 300 3 5 5 1 w w 7 1 3 5 10 St 5 2 0 4 8 8 4 3 6 4 0 1 0 9 5 2 9 9 5 6 8 4 3 40 8 8 9 8 4 9 7 0 7 OL 1 1 9 4 3 8 7 0 9 1 8 4 5 6 7 9 9 6 290 36 160 7 SH 5 4 3 N W 5 2 6 7 7 5 7 4 1 6 5 2 1 7 3 1 3 W N W N 082 3 6 4 1 1 0 4 8 8 1 9 7 3 3 6 5 8 5 с
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education