Count up the squares

Report a typo

Write a program that reads integers (one per line) from the console until their sum is equal to 0. After that, the program should display the sum of the squares of all the entered numbers.

It is guaranteed that at some point the sum of the entered numbers will be equal to 0. After that, you should stop reading the input.

In case the first integer equals 0, just print out 0 instead of the sum of the squares.

You only need to output the sum of the squares once.

Example:

Input (the greater-than symbol followed by space > represents the user input, it's not part of the input):

> 4
> -10
> 6

Output (the sum of squares of numbers 4, -10, and 6):

152

Sample Input 1:

1
-3
5
-6
-10
13
4
-8

Sample Output 1:

340
Write a program in Python 3
# put your python code here
___

Create a free account to access the full topic