C Progamming Ppt (1)

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

LOOPS

IN
C PROGRAMMING

Presented by group B
TABLE OF CONTENTS

 What Are Loops? 🤔


 Why Use Loops? 📈
 Types of Loops🔍
 Nested Loops: Loops Inside Loops 🧩
 Infinite Loops! ♾️
 Summary 🙋
What are loops
● a loop is a process or action that repeats itself
in a continuous cycle.
● Like we are using loop in our playlist.
● In programming a loop is a structure that
repeats a set of instructions or a block of code
multiple times based on a specified condition.
Why use loops
● We use loops to save time and effort by
repeating tasks automatically instead of doing
them manually.
Repetition
LOOPS

Efficiency

Handling data

Flexibility
LOOPS

FOR LOOPS WHILE LOOPS DO-WHILE LOOPS


FOR LOOPS
• Initialization: It is executed before the loop starts. It is often used to initialize a counter
variable.
• Condition: This is the Boolean condition checked before every loop iteration. If the condition
is true, the loop continues; if false, the loop stops.
• Increment/Decrement: This statement is executed after each loop iteration. It is commonly
used to update the counter variable.

Syntax
FLOWCHART
Example
Input Output
WHILE LOOP
How its work

● The condition is evaluated:


if it is true the code inside the loop runs.
if it is false the loop terminates.
● After each iteration, the condition is re-evaluated.
● his repeats until the condition becomes false.
Example
Output
Do-While Loop
How its works
● The code block is executed first, regardless of the
condition.
● The condition is checked after the execution of the
code block.
● If the condition is true, the loop continues. If it is
false, the loop ends.
Example

Output
Nested Loop
● A nested loop is a loop inside another loop. The inner
loop runs completely for each iteration of the outer
loop.
● In this the first loop run and if the first condition is true
then it enters to the second loop .

Syntax:
Example

Output
Infinite Loops
● An infinite loop in C occurs when a loop runs endlessly
because the condition to terminate is never met. These
loops are useful in scenarios like continuously
monitoring input, servers, or real-time applications.

● It may crash your device or take the full storage.


SUMMERY

Loops Overview: Loops allow you to repeat a block of code multiple times.
● Types of Loops:
For Loop: Used when the number of iterations is known in advance.
While Loop: Repeats as long as a specified condition is true.
Do-While Loop: Similar to while but ensures the block runs at least once.
● Key Features:
Loops simplify repetitive tasks.
They can be controlled using conditions and keywords like break or continue.
● Infinite Loops:
Occur when the loop condition never becomes false.
Useful in programs like servers or event monitoring.
Meet the team
Dibyanshu Rath-240301120163
Debojit Mishra-240301120164
Sahasranshu Sahoo-240301120160
Sumit ku. Prusty-240301120140
Gourav shekhar Nayak-240301120152
THANK
YOU!
Any Queries ????
Credits: This presentation template was created by
Slidesgo, including icons by Flaticon, and
infographics & images by Freepik

You might also like