- C Programming
- C Tutorial
- C Basic Syntax
- C Data Types
- C if...else Statement
- C switch Statement
- C for Loop
- C while Loop
- C do...while Loop
- C Jump Statements
- C Arrays
- C Strings
- C Pointers
- C Functions
- C Recursion
- C Variable Scope
- C Structures
- C Linked Lists
- C Stacks
- C Queues
- C Binary Trees
- C Header Files
- C File I/O
- C Programming Examples
- C Programming Examples
- Computer Programming
- C++ Tutorial
- C++ Examples
- C# Tutorial
- Python Tutorial
- Python Keywords
- Python Built-in Functions
- Python Examples
- Java Tutorial
- Java Examples
- PHP Tutorial
- Web Development
- HTML Tutorial
- CSS Tutorial
- JavaScript Tutorial
- SQL Tutorial
C Loops
In C, loops allows a set of instructions to be repeatedly executed until a certain condition is reached. However, the condition, may be predetermined (as in for loop) or open ended (as in while and do-while loops).
C Types of Loops
C allows the following three types of loops:
C Infinite Loop
In C, you can use any loop statement to create an infinite loop.
Here is an example program of infinite loop in C.
/* C Loops - The infinite loop */ #include<stdio.h> #include<conio.h> void main() { clrscr(); for(;;) { printf("* "); } getch(); }
As you can see, when the condition expression is absent, then it is assumed to be true.
Here is the sample run of this C program. The printing of stars(*) continue forever.

C Loop Control Statements
There are three types of statements that controls the loop in C, these are:
More Examples
Here are some more examples that you can go for:
- Make Simple Calculator
- Print Table of Number
- Print Prime Numbers
- Add n Numbers
- Find Factorial of Number
- Find HCF and LCM
- Generate Armstrong Numbers
- Pattern Printing Programs
- Print Diamond Pattern
- Print Floyd Triangle
- Print Pascal Triangle
- Linear Search
- Binary Search
- Reverse Array
- Merge two Array
- Bubble Sort
- Selection Sort
- Insertion Sort
« Previous Tutorial Next Tutorial »
Follow/Like Us on Facebook
Subscribe Us on YouTube