# Counting program in C

#### Learn Big Data Hadoop: Hands-On for Beginner

43 Lectures 1.5 hours

#### Practical C++: Learn C++ Basics Step by Step

Most Popular

50 Lectures 4.5 hours

#### Learn Apache Poi

11 Lectures 2 hours

Counting is sequence of whole numbers in ascending order without zero. Developing a program of counting in C programming language is easy and we shall see here in this chapter.

## Algorithm

Let's first see what should be the step-by-step procedure for counting −

```START
Step 1 → Define start and end of counting
Step 2 → Iterate from start to end
Step 3 → Display loop value at each iteration
STOP
```

## Pseudocode

Let's now see the pseudocode of this algorithm −

```procedure counting()

FOR value = START to END DO
DISPLAY value
END FOR

end procedure
```

## Implementation

Now, we shall see the actual implementation of the program −

```#include <stdio.h>

int main() {
int i, start, end;

start = 1;
end = 10;

for(i = start; i <= end; i++)
printf("%2d\n", i);

return 0;
}
```

## Output

Output of this program should be −

``` 1
2
3
4
5
6
7
8
9
10
```
loop_examples_in_c.htm