Write a program to print the sum of series.. 1+(1+3)+(1+3+5)......n term using for loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write a program to print the sum of series.. 1+(1+3)+(1+3+5)......n term using for loop

using loop and .. goto statement

11th Sep 2017, 7:51 AM
rishabh Singh
rishabh Singh - avatar
1 Answer
+ 5
It is basically sum of squares until ((n-1)/2)^2 Use this hint. Sum of n squares from 1 to n is n(n+1)(2n+1)/6
11th Sep 2017, 8:27 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar