Law
Law, 26.02.2020 06:31, natalie2sheffield

Two files named numbers1.txt and numbers2.txt both have an unknown number of lines, each line consisting of a single positive integer. Write some code that reads a line from one file and then a line from the other file. The two integers are multiplied together and their product is added to a variable called scalar_product which should be initialized to zero.

Your code should stop when it detects end of file in either file that it is reading.

For example, if the sequence of integers in one file was "9 7 5 18 13 2 22 16" and "4 7 8 2" in the other file, your code would compute:

4*9 + 7*7 + 8*5 + 2*18

and thus store 161 into scalar_product.

answer
Answers: 2

Other questions on the subject: Law

image
Law, 03.07.2019 15:10, jadeevasquez200
Difference between joint tenancy and tenancy in common
Answers: 3
image
Law, 03.07.2019 15:10, ecenteno2004
What does charged off as bad debt canceled by credit grantor mean?
Answers: 2
image
Law, 05.07.2019 20:30, smartperraorwhateva
Asign featuring a red circle and red line crossing over an image
Answers: 1
image
Law, 07.07.2019 10:10, Spongebone4571
Amotion that asks the court to determine if there is any actual issue of material fact based on the pleadings and affidavit
Answers: 3
Do you know the correct answer?
Two files named numbers1.txt and numbers2.txt both have an unknown number of lines, each line consis...

Questions in other subjects: