← Back to Structs
Question 415
Dot Product of Two Vectors
Dot Product of Two Vectors
Two vectors are given:a = {1, 2}andb = {3, 4}. The dot product isa.x*b.x + a.y*b.y. Compute and print it (see Expected Output). That is1*3 + 2*4 = 3 + 8 = 11. There is no trailing newline.
Expected Output:
11= newline. No newline after the last line.
Hints2 available
Sign in to use hintsTopics:
Structs
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.