+ 2
Series
Can any one solve it? :- WAP to print the sum of this series:- 2+6+12+20........n
2 Answers
+ 16
s1= 2 + 6 + 12 + 20
4 6 8
2 2
0
//here general term forming is n(n+1) , by substracting s1 from s1 after shifting a term & then finding nth term
//so u just need to do summation of nth term & formula comed ...
đhere is the formula formed
[n.(n+1).(2n+1)] / 6 + n.(n+1)/2
//enjoy the 1-liner solnđ
+ 12
//adding to my answer above ,
maths made it 1-liner , but U can try with programming also ... Use a loop
//loop runs for number of terms U want to sum up
start from t=4 & after each iteration of loop ... change value t to t+=2 ,
do sum+=t //sum=0 initially
//hope mathematical & programming answer , both helped