ShriRam Changed status to publish July 15, 2022
#include<stdio.h>
void main()
{
int n,i,sum=0;
printf("Enter the max values of series: ");
scanf("%d",&n);
sum = (n * (n + 1)) / 2;
printf("Sum of the series: ");
i=1;
while (i<=n)
{
if (i!=n)
printf("%d + ",i);
else
printf("%d = %d ",i,sum);
i++;
}
getch();
}
ShriRam Changed status to publish July 15, 2022