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

To calculate sum of the first N terms of the series:
2,10,30,68....

Solution using C language:

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

Output:
Enter the range of the series
6
the sum of series till 6 is 462
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