The document discusses different types of loops in C programming: for loops, while loops, and do-while loops. For loops allow initialization of a variable, specify a condition, and how to increment the variable. While loops repeatedly execute code as long as a condition is true. Do-while loops are similar but check the condition at the bottom of the loop, so the code executes at least once. Examples of each loop type are provided.
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Â
Loops in c
1.
2. Loops In C Program
Typing Speed: 24
Ismail
Ismailpk456@gmail.com
Ismail Ismu
Ismail Ismu
in.linkedin.com/in/profilena
me
8086303494
3. Loop
ï± There may be a situation, when you need to execute a block
of code several number of times. In general, statements are
executed sequentially: The first statement in a function is
executed first, followed by the second, and so on.
ï± Programming languages provide various control structures
that allow for more complicated execution paths.
ï± A loop statement allows us to execute a statement or group
of statements multiple times and following is the general form
of a loop statement in most of the programming languages
4. Loops In C
Entry control loop
ï for loop
ï while loop
Exit control loop
ï do while loop
5. for loop
âą The traditional for loop found in C requires 3
parts:
1) Initialization
2) Condition
3) Increment
6. While loop
âą A while loop statement in C programming
language repeatedly executes a target
statement as long as a given condition is true.
7. Do while loop
âą which test the loop condition at the top of the
loop, the do...while loop in C programming
language checks its condition at the bottom of
the loop.
âą A do...while loop is similar to a while loop,
except that a do...while loop is guaranteed to
execute at least one time
8. For loop
Syntax
for ( variable initialization; condition; variable update )
{
Code to execute while the condition is true
}
Example
for (j=0;j<5 ;j++)
{
printf(âHaiâ);
}
11. If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
12. Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 â 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 â 495 40 25 550