Top News

C programming Telugu :C Control Statements in C Programming | if else, switch, loops, break, continue in Telugu

 

C Control Statements in C Programming (Telugu Explanation)-C programming Telugu


C programming Telugu
C programming Telugu


C Programming లో Control Statements అంటే program execution ని మనం ఎటువంటి పరిస్థితులు లేదా శ‌ర్తుల ఆధారంగా నియంత్రించుకోవడాన్ని అంటారు. ఇవి ప్రతి ప్రోగ్రామర్ తప్పనిసరిగా నేర్చుకోవలసిన ముఖ్యమైన concepts.

ఈ పోస్ట్‌లో మీరు నేర్చుకునేవి:

  • if / else

  • else-if ladder

  • nested if

  • switch case

  • for loop

  • while loop

  • do-while loop

  • break, continue


1. if / else Statement

if statement ఒక condition true అయితే ఒక block run అవుతుంది.
else condition false అయితే execute అవుతుంది.

Syntax

if (condition) { statements; } else { statements; }

Example

int age = 18; if (age >= 18) { printf("Eligible for vote"); } else { printf("Not eligible"); }

2. else-if Ladder

Multiple conditions చెక్ చేయడానికి ఉపయోగిస్తారు.

Example

int marks = 75; if (marks >= 90) printf("A Grade"); else if (marks >= 75) printf("B Grade"); else if (marks >= 50) printf("C Grade"); else printf("Fail");

3. Nested if

ఒక if లో ఇంకొక if ఉండడం.

Example

int a = 10, b = 20; if (a > 0) { if (b > 0) { printf("Both are positive"); } }

4. switch Statement

Multiple options లో ఒక option execute చేయడానికి ఉపయో్‌గిస్తారు.

Syntax

switch(value) { case 1: statements; break; case 2: statements; break; default: statements; }

Example

int choice = 2; switch(choice) { case 1: printf("One"); break; case 2: printf("Two"); break; default: printf("Invalid"); }

🔄 LOOPS in C


5. for Loop

Repeated execution కోసం పనిచేసే most used loop.

Syntax

for(initialization; condition; increment) { statements; }

Example

for (int i=1; i<=5; i++) { printf("%d ", i); }

6. while Loop

Condition true ఉన్నంత వరకూ run అవుతుంది.

Syntax

while (condition) { statements; }

Example

int i = 1; while (i <= 5) { printf("%d ", i); i++; }

7. do-while Loop

At least one time execute అవుతుంది (condition false అయినా కూడా).

Syntax

do { statements; } while (condition);

Example

int i = 1; do { printf("%d ", i); i++; } while (i <= 5);

8. break Statement

Loop లేదా switch ని వెంటనే stop చేస్తుంది.

Example

for(int i=1; i<=10; i++) { if(i == 5) break; printf("%d ", i); }

9. continue Statement

Current iteration skip చేసి next iteration కి వెళ్లుతుంది.

Example

for(int i=1; i<=5; i++) { if(i == 3) continue; printf("%d ", i); }

🎯 Conclusion

C language లో Control Statements చాలా ముఖ్యమైనవి. ఇవి లేకుండా ఏ program ను కూడా రూపొందించలేము. If/else నుండి loops వరకు ప్రతి concept program flow ను నియంత్రించడంలో కీలకం.

Post a Comment

Previous Post Next Post