RosettaCodeData/Task/Dot-product/DWScript/dot-product-1.dw
2023-07-01 13:44:08 -04:00

12 lines
228 B
Text

function DotProduct(a, b : array of Float) : Float;
require
a.Length = b.Length;
var
i : Integer;
begin
Result := 0;
for i := 0 to a.High do
Result += a[i]*b[i];
end;
PrintLn(DotProduct([1,3,-5], [4,-2,-1]));