Find the sum of the series 1+4+9+16+...........+100 | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Find the sum of the series 1+4+9+16+...........+100

what is the code with output

4th Feb 2018, 2:26 PM
Shubham Chaurasiya
Shubham Chaurasiya - avatar
2 Réponses
+ 15
n (n+1)(2n+1)/6 //sometimes simple math helps ☺
4th Feb 2018, 3:35 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 5
Looks like you are searching for the sum of a series of squared numbers. You could either use a for-loop to iterate through the numbers from 1-10 and add their square to a variable holding the sum, or you could use this formular: https://code.sololearn.com/cZU28jZKCiFZ/?ref=app
4th Feb 2018, 2:41 PM
Shadow
Shadow - avatar