0

Why isn't this code working ?

How did sum in the code turn it zero. https://code.sololearn.com/czz9PXvpLdvm/?ref=app

12th Sep 2020, 7:37 PM
Joseph Oritseweyinmi
Joseph Oritseweyinmi - avatar
7 Answers
+ 1
It working fine.. Sum is not turning 0 also... What is you expected output?
12th Sep 2020, 7:59 PM
Jayakrishna🇮🇳
Jayakrishna🇮🇳 - avatar
+ 1
Sum2 increases every loop
12th Sep 2020, 8:00 PM
Yahya Bey
Yahya Bey - avatar
+ 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
12th Sep 2020, 8:03 PM
Joseph Oritseweyinmi
Joseph Oritseweyinmi - avatar
+ 1
I don't understanding squires of sums below 100. Is it not like pow(1+2+3...+99 , 2)? Joseph Oritseweyinmi
12th Sep 2020, 8:42 PM
Jayakrishna🇮🇳
Jayakrishna🇮🇳 - avatar
+ 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...
12th Sep 2020, 8:57 PM
Yahya Bey
Yahya Bey - avatar
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.
12th Sep 2020, 8:51 PM
Joseph Oritseweyinmi
Joseph Oritseweyinmi - avatar
0
Yes. That works fine.
12th Sep 2020, 9:43 PM
Jayakrishna🇮🇳
Jayakrishna🇮🇳 - avatar