In C programming language, a loop is a sequence of instruction s that is executed repeatedly until a certain condition is satisfied. Mostly, a specific process is done, such as getting data and changing it, and then some prescribed condition is checked such as whether a counter has reached a prescribed number. Here in this C programming tutorial we use almost all types of loops in our programs.
Below flowchart describes the working of a typical loop in C programming.
WHILE LOOP IN C
while a given condition is true, a statement or group of statements is executed continuously in c language. Initial condition is always checked before executing the loop body as shown below.
FOR LOOP IN C
A variable which is initialized to a prescribed value is compared with a condition, if true then body of the loop is executed and variable is incremented the loop will continue to go no until it reached the prescribed value. for loop structure is like initialization, condition and finally increment. For loop is one of the best used loop in C programming.
NESTED LOOPS IN C
In nested loops, a loop is used with in another loop which makes a nested structure of loops in C language, C programming language provides this capabilities.

Tidak ada komentar:
Posting Komentar