calculate the sum of squares of given input of numbers

2 answers

sum=0
for i=1..n
read x
sum += x*x
next i
sum=0
for i=1..n
read x
sum += x*x
next i