# Arithmetic Progression C Program

## C Program To Calculate Arithmetic Progression

Learn How To Calculate Arithmetic Progression in C Programming Language. This C Program For Arithmetic Sequence Computation is done using Two Methods viz. For Loop and While Loop. In an Arithmetic Progression Series, every consecutive element has a **Constant Difference** between every Two Terms.

#### What is Arithmetic Progression?

An Arithmetic Sequence or Arithmetic Progression is a sequence or series of Numbers in such a way that the difference between the Two Consecutive Terms is Constant. This means that the preceding term and the following terms will have the same difference.

Therefore, an Arithmetic Progression is a Series in which every next term after the first term is computed by adding the Common Difference (entered by the User) and the the Preceding Term.

Let’s assume that the First Term is A and the Common Difference is D. Therefore, the terms in an Arithmetic Series will be as follows:

**A, A + 1D, A +2D, A+ 3D**

**The Nth Term will be: A + (N – 1)*D**

#### Example For Arithmetic Series

**1 5 9 13 17 21 25**

#### Arithmetic Sequence Formula

**A _{N} = A_{1} + (N – 1)D**

#### C Program To Calculate Arithmetic Sequence using For Loop

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> int main() { int counter, limit, common_difference, term; printf("\nEnter Total Number of Terms: \t"); scanf("%d", &limit); printf("\nEnter Common Difference: \t "); scanf("%d", &common_difference); printf("\nArithmetic Sequence From 1 To %d:\n", limit); for(counter = 1; counter <= limit; counter++) { term = 1 + (counter - 1) * common_difference; printf("%d \t", term); } printf("\n\n"); return 0; } |

#### Find Arithmetic Progression in C Programming using While Loop

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <stdio.h> int main() { int counter = 1, limit, common_difference, term; printf("\nEnter Total Number of Terms: \t"); scanf("%d", &limit); printf("\nEnter Common Difference: \t"); scanf("%d", &common_difference); printf("\nArithmetic Sequence From 1 To %d: \n", limit); while(counter <= limit) { term = 1 + (counter - 1) * common_difference; printf("%d \t", term); counter++; } printf("\n\n"); return 0; } |

#### Output

If you have any compilation errors or doubts in this C Program To Calculate Arithmetic Progression, let us know about in the Comment Section below.

Can we make up a program to find arithmetic progression in using Function? It will help me to modularize the program.

Yes! This C Program for Arithmetic progression can be developed using functions. You just need to copy the data within the for loop inside a separate user defined function

Perfect Explanation to Print Arithmetic Progression in C Programming. Thanks.