SlideShare une entreprise Scribd logo
1  sur  24
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Typing Speed
Week

Target Achieved

1

40

22

2

40

27

3

40

27
Jobs Applied
Week
1
2
3

Company

Designation

Applied Date

Current Status
CONTROL STRUCTURES IN C PROGRAM
Name SREEJITH.K
@gmail.com ksreejith7044@gmail.com
www.facebook.com/username sreejith kappoor
twitter.com/username
in.linkedin.com/in/profilename
sreejithk/76/576/b99/
Phonenumber 919562616566
CONTROL STRUCTURES IN C PROGRAM
• C language possesses such decision making
capabilities and supports the following statements
known as control or decision-making statements.
• There are two types of statements.
• Selection statement.
• Iteration statement.
Selection statements
• It provides decision making capability to a
program and they alter normal flow of control
based on their conditions. They are
• If
• if else
• if else if
• switch
Iteration statements
• It allows a set of instruction to be executed
repeatedly based on some conditions. They
are
• For loop
• While
If statement
• The if statement is a powerful decision
making statement and is used to control the
flow of execution of statements.
• It is basically a two-way decision statement.
IF ELSE
The if....else statement is an extension of the simple if
statement. The general form is
if (condition)
{
True-block statement(s)
}
else
{
False-block statement(s)
}
IF ELSE
PROGRAM TO KNOW THE NUMER IS POSITIVE OR NEGATIVE
• void main()
{
int numb;
printf ("Type any Number : ");
scanf ("%d", &numb);
if(numb > 0)
{
printf ("%d is the positive number", numb);
}
else
printf ("%d is the Negative number", numb);}
IF ELSE IF
• This makes selection from two alternatives.
• If one is selected the other will be skipped.
• But if the first one is not executed the second
one is selected.
IF ELSE IF
program to print the character is uppercase or lowercase or special
character

Printf(“enter the character”);
Scanf(“%c”,ch);
If(ch>=‘a’ && ch<=‘z’)
printf(“it is lower case”);
Else If(ch>=‘A’ && ch<=‘Z’);
printf(“it is upper case”);
Else
Printf(“it is special chara”);
Switch case
• Often a break statement is used as the last
statement in each case's statement list
• A break statement causes control to transfer
to the end of the switch statement
• If a break statement is not used, the flow of
control will continue into the next case
SWITCH
• The general syntax of a switch statement is:
switch ( expression )
{
case value1 :
statement-list1
case value2 :
statement-list2
case value3 :
statement-list3
case ...
}

If expression
matches
value2,
control jumps
to here
Sample program for switch
Printf ("enter the game moden");
scanf ("%c“,&n);
switch(n)
{
case '1' :
printf("play game n");
break;
case '2' :
printf("load game n");
break;}
while
• The syntax of while statement in C:
while (loop repetition condition)
statement
• Loop repetition condition is the condition which
controls the loop.
• The statement is repeated as long as the loop
repetition condition is true.
• A loop is called an infinite loop if the loop
repetition condition is always true.
An Example of a while Loop
Loop repetition condition

Statement

Loop control variable is the variable whose value controls loop repetition.
In this example, count_emp is the loop control variable.

5-20
For loop
• The syntax of for statement in C:
for (initialization expression;
loop repetition condition;
update expression)
statement
• The initialization expression set the initial value of the
loop control variable.
• The loop repetition condition test the value of the
loop control variable.
• The update expression update the loop control
variable.
An Example of the for Loop
To print the numbers
printf("enter the first number");
scanf("%d",&n);
printf("the numbers aren");
{
for(i=n;i<=100;i++)
printf("%d ",&i);}
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.

Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550

Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550

Contenu connexe

En vedette (6)

Ajax
Ajax Ajax
Ajax
 
Json
JsonJson
Json
 
Post and get methods
Post and get methodsPost and get methods
Post and get methods
 
Ajax
AjaxAjax
Ajax
 
Views and functions
Views and functionsViews and functions
Views and functions
 
Dom structure
Dom structure Dom structure
Dom structure
 

Similaire à Control structers in c

2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.pptManojKhadilkar1
 
PPT_203105211_3.pptx
PPT_203105211_3.pptxPPT_203105211_3.pptx
PPT_203105211_3.pptxSaurabhNage1
 
Control statements anil
Control statements anilControl statements anil
Control statements anilAnil Dutt
 
Introduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow controlIntroduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow controlENGWAU TONNY
 
Control Structures.pptx
Control Structures.pptxControl Structures.pptx
Control Structures.pptxssuserfb3c3e
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements Tarun Sharma
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structuresayshasafdarwaada
 
Fundamental of Information Technology - UNIT 8
Fundamental of Information Technology - UNIT 8Fundamental of Information Technology - UNIT 8
Fundamental of Information Technology - UNIT 8Shipra Swati
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptxSKUP1
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptxLECO9
 
Control Statement IN C.pptx
Control Statement IN C.pptxControl Statement IN C.pptx
Control Statement IN C.pptxsujatha629799
 
NRG 106_Session 4_CLanguage.pptx
NRG 106_Session 4_CLanguage.pptxNRG 106_Session 4_CLanguage.pptx
NRG 106_Session 4_CLanguage.pptxKRIPABHARDWAJ1
 
Conditional Statement both conditional and loop.pptx
Conditional Statement both conditional and loop.pptxConditional Statement both conditional and loop.pptx
Conditional Statement both conditional and loop.pptxZenith SVG
 
Unit 3 principles of programming language
Unit 3 principles of programming languageUnit 3 principles of programming language
Unit 3 principles of programming languageVasavi College of Engg
 

Similaire à Control structers in c (20)

Control structures in C
Control structures in CControl structures in C
Control structures in C
 
Control statement in c
Control statement in cControl statement in c
Control statement in c
 
2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt
 
PPT_203105211_3.pptx
PPT_203105211_3.pptxPPT_203105211_3.pptx
PPT_203105211_3.pptx
 
Control statements anil
Control statements anilControl statements anil
Control statements anil
 
Introduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow controlIntroduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow control
 
Control Structures.pptx
Control Structures.pptxControl Structures.pptx
Control Structures.pptx
 
Control structure
Control structureControl structure
Control structure
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
 
Control structure in c
Control structure in cControl structure in c
Control structure in c
 
Control statement-Selective
Control statement-SelectiveControl statement-Selective
Control statement-Selective
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structures
 
Fundamental of Information Technology - UNIT 8
Fundamental of Information Technology - UNIT 8Fundamental of Information Technology - UNIT 8
Fundamental of Information Technology - UNIT 8
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptx
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptx
 
Control Statement IN C.pptx
Control Statement IN C.pptxControl Statement IN C.pptx
Control Statement IN C.pptx
 
NRG 106_Session 4_CLanguage.pptx
NRG 106_Session 4_CLanguage.pptxNRG 106_Session 4_CLanguage.pptx
NRG 106_Session 4_CLanguage.pptx
 
Conditional Statement both conditional and loop.pptx
Conditional Statement both conditional and loop.pptxConditional Statement both conditional and loop.pptx
Conditional Statement both conditional and loop.pptx
 
Unit 3 principles of programming language
Unit 3 principles of programming languageUnit 3 principles of programming language
Unit 3 principles of programming language
 
Controls & Loops in C
Controls & Loops in C Controls & Loops in C
Controls & Loops in C
 

Plus de baabtra.com - No. 1 supplier of quality freshers

Plus de baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Dernier

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 

Dernier (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

Control structers in c

  • 1.
  • 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 5. CONTROL STRUCTURES IN C PROGRAM Name SREEJITH.K @gmail.com ksreejith7044@gmail.com www.facebook.com/username sreejith kappoor twitter.com/username in.linkedin.com/in/profilename sreejithk/76/576/b99/ Phonenumber 919562616566
  • 6. CONTROL STRUCTURES IN C PROGRAM • C language possesses such decision making capabilities and supports the following statements known as control or decision-making statements. • There are two types of statements. • Selection statement. • Iteration statement.
  • 7. Selection statements • It provides decision making capability to a program and they alter normal flow of control based on their conditions. They are • If • if else • if else if • switch
  • 8. Iteration statements • It allows a set of instruction to be executed repeatedly based on some conditions. They are • For loop • While
  • 9.
  • 10. If statement • The if statement is a powerful decision making statement and is used to control the flow of execution of statements. • It is basically a two-way decision statement.
  • 11. IF ELSE The if....else statement is an extension of the simple if statement. The general form is if (condition) { True-block statement(s) } else { False-block statement(s) }
  • 12. IF ELSE PROGRAM TO KNOW THE NUMER IS POSITIVE OR NEGATIVE • void main() { int numb; printf ("Type any Number : "); scanf ("%d", &numb); if(numb > 0) { printf ("%d is the positive number", numb); } else printf ("%d is the Negative number", numb);}
  • 13. IF ELSE IF • This makes selection from two alternatives. • If one is selected the other will be skipped. • But if the first one is not executed the second one is selected.
  • 14. IF ELSE IF program to print the character is uppercase or lowercase or special character Printf(“enter the character”); Scanf(“%c”,ch); If(ch>=‘a’ && ch<=‘z’) printf(“it is lower case”); Else If(ch>=‘A’ && ch<=‘Z’); printf(“it is upper case”); Else Printf(“it is special chara”);
  • 15. Switch case • Often a break statement is used as the last statement in each case's statement list • A break statement causes control to transfer to the end of the switch statement • If a break statement is not used, the flow of control will continue into the next case
  • 16. SWITCH • The general syntax of a switch statement is: switch ( expression ) { case value1 : statement-list1 case value2 : statement-list2 case value3 : statement-list3 case ... } If expression matches value2, control jumps to here
  • 17. Sample program for switch Printf ("enter the game moden"); scanf ("%c“,&n); switch(n) { case '1' : printf("play game n"); break; case '2' : printf("load game n"); break;}
  • 18.
  • 19. while • The syntax of while statement in C: while (loop repetition condition) statement • Loop repetition condition is the condition which controls the loop. • The statement is repeated as long as the loop repetition condition is true. • A loop is called an infinite loop if the loop repetition condition is always true.
  • 20. An Example of a while Loop Loop repetition condition Statement Loop control variable is the variable whose value controls loop repetition. In this example, count_emp is the loop control variable. 5-20
  • 21. For loop • The syntax of for statement in C: for (initialization expression; loop repetition condition; update expression) statement • The initialization expression set the initial value of the loop control variable. • The loop repetition condition test the value of the loop control variable. • The update expression update the loop control variable.
  • 22. An Example of the for Loop To print the numbers printf("enter the first number"); scanf("%d",&n); printf("the numbers aren"); { for(i=n;i<=100;i++) printf("%d ",&i);}
  • 23. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 24. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550