- Write a C program to find the sum of arithmetic series till N terms.
- Write a C program to print arithmetic series till N terms.

**Arithmetic series** is a sequence of terms in which next term is obtained by adding common difference to previous term. Let, t_{n} be the n^{th} term of AP, then (n+1)^{th} term of can be calculated as <br\>(n+1)^{th} = t_{n} + D

where D is the common difference (n+1)^{th} – t_{n}

The formula to calculate N^{th} term t_{n} = a + (n – 1)d;

where, **a** is first term of AP and **d** is the common difference.</br\>

### C program to print arithmetic progression series and it’s sum till N terms

In this program, we first take number of terms, first term and common difference as input from user using scanf function. Then we calculate the arithmetic series using above formula(by adding common difference to previous term) inside a for loop. We keep on adding the current term’s value to sum variable.

/* * C program to print Arithmetic Series and it's sum till Nth term */ #include <stdio.h> #include <stdlib.h> int main() { int first, diff, terms, value, sum=0, i; printf("Enter the number of terms in AP series\n"); scanf("%d", &terms); printf("Enter first term and common difference of AP series\n"); scanf("%d %d", &first, &diff); /* print the series and add all elements to sum */ value = first; printf("AP SERIES\n"); for(i = 0; i < terms; i++) { printf("%d ", value); sum += value; value = value + diff; } printf("\nSum of the AP series till %d terms is %d\n", terms, sum); getch(); return 0; }

**Program Output**

Enter the number of terms in AP series 5 Enter first term and common difference of AP series 2 4 AP SERIES 2 6 10 14 18 Sum of the AP series till 5 terms is 50

**Try these:**

- A given series could be an arithmetic progression a geometric progression in c++
- A given series could be an arithmetic progression a geometric progression in c
- C program to find sum of arithmetic progression
- C program to find nth term in arithmetic progression
- An arithmetic progression series of 18 term with common difference d
- Arithmetic progression in c using for loop
- Geometric progression program in c
- Arithmetic progression program in c
- Arithmetic progression in c skillrack
- Arithmetic progression in c++ skillrack