RosettaCodeData/Task/Dot-product/XPL0/dot-product.xpl0
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

13 lines
191 B
Text

include c:\cxpl\codes;
func DotProd(U, V, L);
int U, V, L;
int S, I;
[S:= 0;
for I:= 0 to L-1 do S:= S + U(I)*V(I);
return S;
];
[IntOut(0, DotProd([1, 3, -5], [4, -2, -1], 3));
CrLf(0);
]