- C Programming Basics
- C Tutorial
- C Program Structure
- C Basic Syntax
- C Data Types
- C Constants
- C Variables
- C Operators
- C Ternary Operator
- C Storage Classes
- C Flow of Control
- C Decision Making
- C if if-else Statement
- C switch Statement
- C Loops
- C for Loop
- C while Loop
- C do-while Loop
- C goto Statement
- C break Statement
- C continue Statement
- C Popular Topics
- C Arrays
- C Strings
- C Pointers
- C Functions
- C Recursion
- C Scope Rules
- C Programming Advance
- C Structures
- C Unions
- C Bit Fields
- C Enumerations
- C Input & Output
- C Typedef
- C Preprocessors
- C Type Casting
- C Recursion
- C Error Handling
- C Linked Lists
- C Stacks
- C Queues
- C Binary Trees
- C Header Files
- C File I/O
- C Variable Arguments
- C Memory Management
- C Command Line Arguments
- C Programming Examples
- C Programming Examples
- C Programming Library
- C Standard Library
- C Programming Test
- C Programming Test
- Give Online Test
- All Test List
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 »