๐Ÿ’ป Day 85: Loops Concept in C – Hinglish

 

๐Ÿ’ป Loops Concept in C – 

๐Ÿ‘‰ Aaj hum seekhenge:
✅ Loop kya hota hai
✅ Types of loops
✅ Real-life examples
✅ Simple programs
(Very important topic ๐Ÿ’ฏ)


๐Ÿ“Œ Loop kya hota hai?

๐Ÿ‘‰ Jab kisi kaam ko bar-bar repeat karna ho,
toh hum loop use karte hain.

➡️ Simple words me:
Loop = Repeat process ๐Ÿ”

๐Ÿง  Example (Real Life):

  • 1 se 10 tak ginti bolna

  • Attendance list print karna

  • Table print karna


๐Ÿงฉ Types of Loops in C

1️⃣ for Loop

๐Ÿ‘‰ Jab hume pata ho kitni baar loop chalega.

Syntax:

for(initialization; condition; increment/decrement) {
    // code
}

Example:

#include <stdio.h>
int main() {
    int i;
    for(i = 1; i <= 5; i++) {
        printf("%d\n", i);
    }
    return 0;
}

2️⃣ while Loop

๐Ÿ‘‰ Jab condition pe depend ho.

Syntax:

while(condition) {
    // code
}

Example:

#include <stdio.h>
int main() {
    int i = 1;
    while(i <= 5) {
        printf("%d\n", i);
        i++;
    }
    return 0;
}

3️⃣ do-while Loop

๐Ÿ‘‰ Kam se kam ek baar chalega.

Syntax:

do {
    // code
} while(condition);

Example:

#include <stdio.h>
int main() {
    int i = 1;
    do {
        printf("%d\n", i);
        i++;
    } while(i <= 5);
    return 0;
}

๐Ÿ†š Difference (Simple Table)

LoopUse
forFixed times
whileCondition based
do-whileAt least once

๐Ÿงช Practice Questions

✅ Theory:

  1. Loop kya hota hai?

  2. for, while, do-while me difference likho.

  3. do-while loop ki special feature kya hai?

✅ Practical:

๐Ÿ‘‰ Program likho:

  • 1 se 10 tak number print

  • Table of 5

  • Sum of first 10 numbers


๐Ÿ“ Short Notes (Exam ke liye)

๐Ÿ‘‰ Loop = repetition
๐Ÿ‘‰ for, while, do-while = types of loops


⬅ Previous Day


                            Next Day ➡