Write a program to calculate the dot product of two vectors.
MediumProblem Statement
Write a program to calculate the dot product of two vectors.
Sample Input
Vector 1: c(1, 2, 3) Vector 2: c(4, 5, 6)
Sample Output
Dot Product: 32
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
# Predefined structure
vector1 <- # Define the first vector
vector2 <- # Define the second vector
dot_product <- # Calculate the dot product
print(paste("Dot Product:", dot_product))
Input
Vector 1: c(1, 2, 3) Vector 2: c(4, 5, 6)
Expected Output
Dot Product: 32