0% found this document useful (0 votes)
7 views20 pages

C - While Loop

The document discusses while loops in C programming. It provides the syntax and examples of while loops, do/while loops, and how they can be used to repeatedly execute code blocks based on boolean conditions or loop through numbers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views20 pages

C - While Loop

The document discusses while loops in C programming. It provides the syntax and examples of while loops, do/while loops, and how they can be used to repeatedly execute code blocks based on boolean conditions or loop through numbers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

C - While Loop

while loop
• While loop is also known as a pre-tested loop.
• In general, a while loop allows a part of the code to
be executed multiple times depending upon a given
boolean condition.
• It can be viewed as a repeating if statement.
• The while loop is one of the most frequently used
types of loops in C.
Syntax of While Loop
Example 1
Prints All the
Lowercase
Example 3
Example 4
Example 5
Example 6
Example 7
The Do/While Loop
The Do/While Loop
• The do/while loop is a variant of the while loop.

• A "do-while" loop is a form of a loop in C that


executes the code block first, followed by the
condition.

• If the condition is true, the loop continues to run;


else, it stops.
do while loop syntax
Print
given number
Program that Prints
the Multiplication Table
Infinite do while loop
Program to print
Natural Numbers
in Reverse
Thank You

You might also like