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


sumOfSquares(list) {
  var sum=0;
  list.forEach((var n) { sum+=(n*n); });
  return sum;
}
 
main() {
  print(sumOfSquares([]));
  print(sumOfSquares([1,2,3]));
  print(sumOfSquares([10]));
}