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

To calculate sum of the first N terms of the series:
1.2.3+2.3.4+....+n(n+1)(n+2)

Solution using C language:

#include <stdio.h>
#include<math.h>
int main() {
   float n = 6;
   int res = 0;
   for (int i = 1; i <= n; i++)
      res += (i) * (i + 1) * (i + 2);
   printf("The sum is : %d",res);
   return 0;
}
Output:
The sum is : 756
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