Sum of Series||C language||programming_info ||Series problem 10

To calculate sum of the first N terms of the series:
5,12,23,38,......

Solution using C language:

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

Output:
Enter the range
6
the sum of series till 6 is 215
Share:

No comments:

Post a Comment

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Blog Archive

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support