0
Why isn't this code working ?
How did sum in the code turn it zero. https://code.sololearn.com/czz9PXvpLdvm/?ref=app
7 Antworten
+ 1
It working fine..
Sum is not turning 0 also...
What is you expected output?
+ 1
Sum2 increases every loop
+ 1
I wanted to solve the project euler question sum square difference. My expected output is the difference between the sum of squares below 100 and the square of sums below 100
+ 1
I don't understanding squires of sums below 100.
Is it not like pow(1+2+3...+99 , 2)? Joseph Oritseweyinmi
+ 1
Make input 101 and print sum2*sum2 -sum , problems asks what is the difference between (1+2+3...)**2 and 1+4+9+16+25...
0


Sum square difference
 
Problem 6
The sum of the squares of the first ten natural numbers is,
12+22+...+102=385
The square of the sum of the first ten natural numbers is,
(1+2+...+10)2=552=3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025−385=2640.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
0
Yes. That works fine.