#include<stdio.h>
void main()
{
  int sum=0,i,n;
  printf("\n>>> C Program to print Sum of Series 1+2+3+..+n <<<\n");
  printf("\n Enter the number of terms:");
  scanf("%d",&n);
  for(i=1;i<=n;i++)
  {
      sum+=i;
  }
  printf("\n Sum of series upto %d is :%d \n\n",n,sum);

}

Sample Output:

Sum-Of-Series-Output

Leave a Reply

Your email address will not be published. Required fields are marked *