- Related Questions & Answers
- Average numbers in array in C Programming
- Add minimum number to an array so that the sum becomes even in C programming
- Arithmetic Mean in C programming
- Concatenate a string given number of times in C++ programming
- Write a program to Delete a Tree in C programming
- Write a function that returns 2 for input 1 and returns 1 for 2 in C programming
- Ways to paint N paintings such that adjacent paintings don’t have same colors in C programming
- Surface Area and Volume of Hexagonal Prism in C programming
- Superperfect Number in C programming
- Super Prime in c programming
- Sums of ASCII values of each word in a sentence in c programming
- Sum triangle from an array in C programming
- C Programming for sum of the series 0.6, 0.06, 0.006, 0.0006, …to n terms
- C Programming for Sum of sequence 2, 22, 222, ………
- Sum of the numbers up to N that are divisible by 2 or 5 in c programming

To find the sum of this series, we will first analyze this series.

The series is: 2,6,12,20,30…

For n = 6 Sum = 112 On analysis, (1+1),(2+4),(3+9),(4+16)... (1+1^{2}), (2+2^{2}), (3+3^{2}), (4+4^{2}), can be divided into two series i.e. s1:1,2,3,4,5… andS2: 1^{2},^{2},3^{2},....

Find the sum of first and second using mathematical formula

Sum1 = 1+2+3+4… , sum1 = n*(n+1)/2 Sum2 = 12+2^{2}+3^{2}+4^{2}… , sum1 = n*(n+1)*(2*n +1)/6

#include <stdio.h> int main() { int n = 3; int sum = ((n*(n+1))/2)+((n*(n+1)*(2*n+1))/6); printf("the sum series till %d is %d", n,sum); return 0; }

The sum of series till 3 is 20

Advertisements