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


folder() {
   (read B; res=$( expr $1 \* $1 ) ; test -n "$B" && expr $res + $B || echo $res)
}
 
fold() {
   (while read a ; do
       fold | folder $a
   done)
}
 
 
(echo 3; echo 1; echo 4;echo 1;echo 5; echo 9) | fold