Quiz 10


 

QUESTION 1:

Create a function called findThrees that receives as a parameter a vector/array/list of numbers and returns the sum of all numbers in that vector/array/list that are evenly divisible by 3.

So if the vector/array/list was: {0,4,2,6,9,8,3,12}, the function would return 30 since  (0+6+9+3+12) is 30.

 

QUESTION 2:

Create a function called dotProduct that receives two vectors/arrays/lists of numbers (say v1 and v2). The function returns what is the dot product of the two vectors/arrays/lists.

Example. If the input is {2,4,5,6} and {1,2,3,4} the result will be 49 since (2*1)+(4*2)+(5*3)+(6*4) is 49

 

Github: https://github.com/ARCuriel/Quiz-10/tree/master

CC BY 4.0 Quiz 10 by Aram Curiel is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.