SlideShare a Scribd company logo
Control Flow Structure
• Control structures form the basic entities of a “structured
programming language“.
• Control structures are used to alter the flow of execution of the
program.
There are three types of control structures available in C and C++
• Sequence structure (straight line paths)
• Selection structure (one or many branches)
• Loop structure (repetition of a set of activities)
Sequence structure
Selection structure
If statement
if (condition)
{
Program statements;
}
If else statement
if (condition)
{
Program statements;
}
Else
{
Program statements;
}
Switch statement
switch (expression)
{
Case value_1;
Statement1;
Break;
Case value_2;
Statement2;
break;
Default:
Statementx;
break
}
Problem Statement
If the integer entered by user is 1 – output on screen “UNITED STATES”.
If the integer is 2 – output “SPAIN”, If the integer is 3 output “INDIA”. If
the user enters some other value – output “WRONG ENTRY”.
Loop structure (repetition of a set of activities)
• In programming, there exists situations when you need to repeat
single or a group of statements till some condition is met. Such as -
read all files of a directory, send mail to all employees one after
another etc. These task in C programming is handled by looping
statements.
• Looping statement defines a set of repetitive statements. These
statements are repeated with same or different parameters for a
number of times. Looping statement is also known
as iterative or repetitive statement.
C supports three looping statements.
• for loop
• while loop
• do...while loop
For Loop
• For loop is an entry controlled looping statement. It is used to repeat set of
statements until some condition is met.
• Looping statements whose condition is checked prior to the execution of
its body is called as Entry controlled loop.
Syntax of Loop
for(variable-initialization ; condition ; variable-update)
{
// Body of for loop
}
/** * C program to print natural numbers from 1 to
10. */
#include <stdio.h>
int main()
{
/* Declare loop counter variable */
int count; /* Run a loop from 1 to 10 */
for(count=1; count<=10; count++)
{ /* Print current value of count */
printf("%d ", count);
}
return 0;
}
While Loop
Start
Initializing n=1
n < 10
Stop
Print n
n = n + 1
True
False
Do While Loop
Start
Initializing n=1
n < 10
Stop
Print n
n = n + 1
True
False

More Related Content

Similar to NRG 106_Session 4_CLanguage.pptx

Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
Niket Chandrawanshi
 
control structure by shuja ahmad
control structure by shuja ahmadcontrol structure by shuja ahmad
control structure by shuja ahmad
Inocentshuja Ahmad
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
Tanmay Modi
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
tanmaymodi4
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
Mohammed Saleh
 
JAN CARL BRIONES-Writing Programs Using Loops.pptx
JAN CARL BRIONES-Writing Programs Using Loops.pptxJAN CARL BRIONES-Writing Programs Using Loops.pptx
JAN CARL BRIONES-Writing Programs Using Loops.pptx
JanCarlBriones2
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
sachindane
 
Session 3
Session 3Session 3
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptx
SKUP1
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptx
LECO9
 
C++ rajan
C++ rajanC++ rajan
C++ rajan
Deep Rajan
 
Condition Stmt n Looping stmt.pptx
Condition Stmt n Looping stmt.pptxCondition Stmt n Looping stmt.pptx
Condition Stmt n Looping stmt.pptx
Likhil181
 
C_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.pptC_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.ppt
ganeshkarthy
 
Flow of control C ++ By TANUJ
Flow of control C ++ By TANUJFlow of control C ++ By TANUJ
Flow of control C ++ By TANUJ
TANUJ ⠀
 
control structure
control structurecontrol structure
control structure
sivasankaravadivuN
 
Programming in C
Programming in CProgramming in C
Programming in C
Nishant Munjal
 
C++ decision making
C++ decision makingC++ decision making
C++ decision making
Zohaib Ahmed
 

Similar to NRG 106_Session 4_CLanguage.pptx (20)

Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
control structure by shuja ahmad
control structure by shuja ahmadcontrol structure by shuja ahmad
control structure by shuja ahmad
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
JAN CARL BRIONES-Writing Programs Using Loops.pptx
JAN CARL BRIONES-Writing Programs Using Loops.pptxJAN CARL BRIONES-Writing Programs Using Loops.pptx
JAN CARL BRIONES-Writing Programs Using Loops.pptx
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
 
Session 3
Session 3Session 3
Session 3
 
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
 
Comp ppt (1)
Comp ppt (1)Comp ppt (1)
Comp ppt (1)
 
C++ rajan
C++ rajanC++ rajan
C++ rajan
 
Condition Stmt n Looping stmt.pptx
Condition Stmt n Looping stmt.pptxCondition Stmt n Looping stmt.pptx
Condition Stmt n Looping stmt.pptx
 
C_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.pptC_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.ppt
 
Flow of control C ++ By TANUJ
Flow of control C ++ By TANUJFlow of control C ++ By TANUJ
Flow of control C ++ By TANUJ
 
control structure
control structurecontrol structure
control structure
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetition
 
Ch05
Ch05Ch05
Ch05
 
Programming in C
Programming in CProgramming in C
Programming in C
 
C++ decision making
C++ decision makingC++ decision making
C++ decision making
 

More from KRIPABHARDWAJ1

gis assgnmnt.pptx
gis assgnmnt.pptxgis assgnmnt.pptx
gis assgnmnt.pptx
KRIPABHARDWAJ1
 
NRG 106_Session 6_String&Pointer.pptx
NRG 106_Session 6_String&Pointer.pptxNRG 106_Session 6_String&Pointer.pptx
NRG 106_Session 6_String&Pointer.pptx
KRIPABHARDWAJ1
 
NRG 106_Session 2_FlowCharts.pptx
NRG 106_Session 2_FlowCharts.pptxNRG 106_Session 2_FlowCharts.pptx
NRG 106_Session 2_FlowCharts.pptx
KRIPABHARDWAJ1
 
NRG 106_Session 1_History.pptx
NRG 106_Session 1_History.pptxNRG 106_Session 1_History.pptx
NRG 106_Session 1_History.pptx
KRIPABHARDWAJ1
 
Dams- Politics of Displacement (Domestic) (1).pptx
Dams- Politics of Displacement (Domestic) (1).pptxDams- Politics of Displacement (Domestic) (1).pptx
Dams- Politics of Displacement (Domestic) (1).pptx
KRIPABHARDWAJ1
 
Rain Water Harvesting.pptx
Rain Water Harvesting.pptxRain Water Harvesting.pptx
Rain Water Harvesting.pptx
KRIPABHARDWAJ1
 
FINAL PPT (HYDROLOGY) WATER HARVESTING.pptx
FINAL PPT  (HYDROLOGY) WATER HARVESTING.pptxFINAL PPT  (HYDROLOGY) WATER HARVESTING.pptx
FINAL PPT (HYDROLOGY) WATER HARVESTING.pptx
KRIPABHARDWAJ1
 
SOURCES OF POPULATION DATA.pptx
SOURCES OF POPULATION DATA.pptxSOURCES OF POPULATION DATA.pptx
SOURCES OF POPULATION DATA.pptx
KRIPABHARDWAJ1
 
French & Industrial Rev..pptx
French & Industrial Rev..pptxFrench & Industrial Rev..pptx
French & Industrial Rev..pptx
KRIPABHARDWAJ1
 
Landslide.pptx
Landslide.pptxLandslide.pptx
Landslide.pptx
KRIPABHARDWAJ1
 

More from KRIPABHARDWAJ1 (10)

gis assgnmnt.pptx
gis assgnmnt.pptxgis assgnmnt.pptx
gis assgnmnt.pptx
 
NRG 106_Session 6_String&Pointer.pptx
NRG 106_Session 6_String&Pointer.pptxNRG 106_Session 6_String&Pointer.pptx
NRG 106_Session 6_String&Pointer.pptx
 
NRG 106_Session 2_FlowCharts.pptx
NRG 106_Session 2_FlowCharts.pptxNRG 106_Session 2_FlowCharts.pptx
NRG 106_Session 2_FlowCharts.pptx
 
NRG 106_Session 1_History.pptx
NRG 106_Session 1_History.pptxNRG 106_Session 1_History.pptx
NRG 106_Session 1_History.pptx
 
Dams- Politics of Displacement (Domestic) (1).pptx
Dams- Politics of Displacement (Domestic) (1).pptxDams- Politics of Displacement (Domestic) (1).pptx
Dams- Politics of Displacement (Domestic) (1).pptx
 
Rain Water Harvesting.pptx
Rain Water Harvesting.pptxRain Water Harvesting.pptx
Rain Water Harvesting.pptx
 
FINAL PPT (HYDROLOGY) WATER HARVESTING.pptx
FINAL PPT  (HYDROLOGY) WATER HARVESTING.pptxFINAL PPT  (HYDROLOGY) WATER HARVESTING.pptx
FINAL PPT (HYDROLOGY) WATER HARVESTING.pptx
 
SOURCES OF POPULATION DATA.pptx
SOURCES OF POPULATION DATA.pptxSOURCES OF POPULATION DATA.pptx
SOURCES OF POPULATION DATA.pptx
 
French & Industrial Rev..pptx
French & Industrial Rev..pptxFrench & Industrial Rev..pptx
French & Industrial Rev..pptx
 
Landslide.pptx
Landslide.pptxLandslide.pptx
Landslide.pptx
 

Recently uploaded

GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 

Recently uploaded (20)

GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 

NRG 106_Session 4_CLanguage.pptx

  • 2. • Control structures form the basic entities of a “structured programming language“. • Control structures are used to alter the flow of execution of the program.
  • 3. There are three types of control structures available in C and C++ • Sequence structure (straight line paths) • Selection structure (one or many branches) • Loop structure (repetition of a set of activities)
  • 6. If statement if (condition) { Program statements; } If else statement if (condition) { Program statements; } Else { Program statements; } Switch statement switch (expression) { Case value_1; Statement1; Break; Case value_2; Statement2; break; Default: Statementx; break }
  • 7. Problem Statement If the integer entered by user is 1 – output on screen “UNITED STATES”. If the integer is 2 – output “SPAIN”, If the integer is 3 output “INDIA”. If the user enters some other value – output “WRONG ENTRY”.
  • 8. Loop structure (repetition of a set of activities) • In programming, there exists situations when you need to repeat single or a group of statements till some condition is met. Such as - read all files of a directory, send mail to all employees one after another etc. These task in C programming is handled by looping statements. • Looping statement defines a set of repetitive statements. These statements are repeated with same or different parameters for a number of times. Looping statement is also known as iterative or repetitive statement.
  • 9. C supports three looping statements. • for loop • while loop • do...while loop
  • 10. For Loop • For loop is an entry controlled looping statement. It is used to repeat set of statements until some condition is met. • Looping statements whose condition is checked prior to the execution of its body is called as Entry controlled loop. Syntax of Loop for(variable-initialization ; condition ; variable-update) { // Body of for loop }
  • 11.
  • 12. /** * C program to print natural numbers from 1 to 10. */ #include <stdio.h> int main() { /* Declare loop counter variable */ int count; /* Run a loop from 1 to 10 */ for(count=1; count<=10; count++) { /* Print current value of count */ printf("%d ", count); } return 0; }
  • 13. While Loop Start Initializing n=1 n < 10 Stop Print n n = n + 1 True False
  • 14. Do While Loop Start Initializing n=1 n < 10 Stop Print n n = n + 1 True False