Task

Write a program to find the sum of squares of a numeric vector.

The program should work on a zero-length vector (with an answer of   0).



Related task

   Mean


include c:\cxpl\codes;  \intrinsic 'code' declarations
 
func SumSq(V, L);
int  V, L;
int  S, I;
[S:= 0;
for I:= 0 to L-1 do S:= S+sq(V(I));
return S;
]; \SumSq
 
[IntOut(0, SumSq([1,2,3,4,5,6,7,8,9,10], 10));  CrLf(0);
 IntOut(0, SumSq([0], 0));  CrLf(0);    \zero-length vector "[]" doesn't compile
]