RosettaCodeData/Task/Dot-product/Visual-Basic-.NET/dot-product.vb

13 lines
282 B
VB.net
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
Module Module1
Function DotProduct(a As Decimal(), b As Decimal()) As Decimal
Return a.Zip(b, Function(x, y) x * y).Sum()
End Function
Sub Main()
Console.WriteLine(DotProduct({1, 3, -5}, {4, -2, -1}))
Console.ReadLine()
End Sub
End Module