In this tutorial learn how you can write a c program to evaluate the series S= 1+ 2×1 +3×2 +….+ nxn-1. where n is given by user.

We are using for loop for this tutorial.

C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.


write a c program to evaluate the series S= 1+ 2x1 +3x2 +….+ nxn-1



Write a Program to Evaluate the Series S= 1+ 2×1 +3×2 +….+ nxn-1

Here is the code to evaluate the series S= 1+ 2×1 +3×2 +….+ nxn-1. where n is given by user. in C programming.

#include <stdio.h> //WAP to evaluate the series S= 1+ 2x1 +3x2 +….+ nxn-1. where n is given by user.
int main()
{
int n, i, sum = 1;
printf("Enter n terms for series:");
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
sum = sum + i * (i - 1);
}
printf("sum of the series is %d.", sum);

return 0;
}

Test Live At Jdoodle


Conclusion

This is how you can evaluate the series S= 1+ 2×1 +3×2 +….+ nxn-1. where n is given by user. in c programming. Comment below if you like our tutorial.