0% found this document useful (0 votes)
110 views

C Programming Loops: While Loop Do... While Loop

Loops allow code to be repeatedly executed in C programming. There are three types of loops - for, while, and do-while - that can be used to run code a specific number of times or as long as a condition is true. The for loop has an initialization statement, test expression, and update statement that control the loop iteration and allow code to run a set number of times.

Uploaded by

Shital Khokhar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views

C Programming Loops: While Loop Do... While Loop

Loops allow code to be repeatedly executed in C programming. There are three types of loops - for, while, and do-while - that can be used to run code a specific number of times or as long as a condition is true. The for loop has an initialization statement, test expression, and update statement that control the loop iteration and allow code to run a set number of times.

Uploaded by

Shital Khokhar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

C Programming Loops

Loops cause program to execute the certain block of code repeatedly until test condition is
false. Loops are used in performing repetitive task in programming. Consider these
scenarios:

You want to execute some code/s 100 times.

You want to execute some code/s certain number of times depending upon
input from user.
These types of task can be solved in programming using loops.
There are 3 types of loops in C programming:

1.

for loop

2.

while loop

3.

do...while loop

for Loop Syntax


for(initialization statement; test expression; update statement) {
code/s to be executed;
}
For example:
For(i=10;i<=10;i++)
{
Printf(%d,i);
}

Different Ways of Using For Loop in C Programming

You might also like