Introduction to Loops in C language.

“Don’t limit your challenges , challenge your limits”


A Very Happy New Year to all…..

Hello everyone………….welcome back with a new article.

Today we are going to see a short introduction to loops in C language.


Soo let’s get started….. 🙂

Now suppose you want to perform a particular task in a repeated manner, for example if you want to print hello world 25 times, what you will do??


In that case you have to write printf statement 25 times right. The solution for this is a Loop

What is Loop???

A loop is a sequence of instructions that is repeated until a certain condition is reached. An operation is done, such as getting an item of data and changing it, and then some condition is checked such as whether a counter has reached a prescribed number.

•If condition is not matched:- In this type, if condition is not matched in very first iteration, the particular number will be incremented by 1 and again the loop will be executed.Until and unless condition is matched , loop will be continuously executed.

•If condition is matched:-In this type, if the condition is matched in very first iteration, instruction will come out of the loop (falls through ). And it will execute the remaining statements outside the loop.

There are mainly two types of loops:-


1) Entry Controlled loops:-
In this type ,condition is checked before entering the loop body.
For loop and while loop are entry controlled loop.

2) Exist Controlled loop:-
In this type, condition is checked at the end of the loop body. Therefore loop will execute at least once irrespective of whether the condition is true or false.


Do-while loop is exist controlled loop.

Some examples where we can use loops:-
1) To find sum of even/odd numbers.
2) To find sum of factors of any number.
3) To find the Fibonacci series.
4) To find multiplication table of any number.
5) To display numbers between given two number.
6) To accept a number and reverse it.
7) To accept a number and to display its sum of digits.
8) To check whether the number is perfect or not. Etc……

In this way, there are many uses of loops.

In upcoming articles will see different type of loops one by one in detail. Soo be connected 🙂

Soo will call it a day….. Hope you all must have got an idea about loops in C.

If you didn’t get any topic, please feel free to ask. I’ll definitely try to clear it.

Thank you so much all for your patience and support 🙂

See you all in next article till then…… good bye… have a wonderful day ahead 🙂

You may also like...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: