๐ป 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)
| Loop | Use |
|---|---|
| for | Fixed times |
| while | Condition based |
| do-while | At least once |
๐งช Practice Questions
✅ Theory:
Loop kya hota hai?
for, while, do-while me difference likho.
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