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

C Program to calculate (1)+(1+2)+(1+2+3)+.....+(1+2+3+...+n)Series.

Solution using C language:
#include<stdio.h>
#include<conio.h>

void main()
{
 int i,j,n,sum=0;
 clrscr();
    n=10;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=i;j++)
        {
            sum+=j;
        }
    }
    printf("Sum: %d",sum);
getch();
}
Output:
sum:385
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