n=int(input())
i=1
s=0
while True:
    t=i**2
    print(t, end=" ")
    i=i+1
    s=s+t
    if i>n:
        break
print("             ")
print("La suma es:", s)


Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: