Xavier Math

Description:

Finding series is a difficult task in Maths. Xavier is given a homework to obtain the sum value for the following series. Your task is to write a code to find the sum of the following series 1 + 2 + . + n Input: Input should contain the value of the limit n Output: It should print the Sum of series upto n limit

Program :

#include <stdio.h>

int main()

{

    int n, i, sum = 0;

    scanf("%d",&n);


    for(i=1; i < n; i++)

    {

     

      printf("%d+",i);

        sum += i;

    }

printf("%d=%d",n,sum+n);

 return 0;

}