SlideShare ist ein Scribd-Unternehmen logo
1 von 2
How many times will the following loop print hello?
i = 1;
while ( i <= 10 )
cout << "hello";
A.0.
B.9.
C.10.
D.An infinite number of times.
Solution
/* if we use this code */
/* main.cpp */
#include <iostream>
using namespace std;
int main()
{
int i = 1;
while ( i <= 10 )
cout << "hello";
return 0;
}
/* then output will be D. an infinite number of times. */
/* hello will be printed infinite number of times because value of i is not increasing means we
have not used i++ in while loop */
How many times will the following loop print hello-  i - 1- while ( i.docx

Weitere ähnliche Inhalte

Mehr von hjeffrey

Mehr von hjeffrey (20)

How is the nature of 21st century communication changing- How is the n.docx
How is the nature of 21st century communication changing- How is the n.docxHow is the nature of 21st century communication changing- How is the n.docx
How is the nature of 21st century communication changing- How is the n.docx
 
How did the enclosures law fuel the Industrial Revolution in Great Bri.docx
How did the enclosures law fuel the Industrial Revolution in Great Bri.docxHow did the enclosures law fuel the Industrial Revolution in Great Bri.docx
How did the enclosures law fuel the Industrial Revolution in Great Bri.docx
 
How do short-term and long-term orientation relate to corporate profit.docx
How do short-term and long-term orientation relate to corporate profit.docxHow do short-term and long-term orientation relate to corporate profit.docx
How do short-term and long-term orientation relate to corporate profit.docx
 
How does the object-oriented view of component-level design differ fro.docx
How does the object-oriented view of component-level design differ fro.docxHow does the object-oriented view of component-level design differ fro.docx
How does the object-oriented view of component-level design differ fro.docx
 
How do the physical features of mainland Southeast Asia compare and co.docx
How do the physical features of mainland Southeast Asia compare and co.docxHow do the physical features of mainland Southeast Asia compare and co.docx
How do the physical features of mainland Southeast Asia compare and co.docx
 
How do many companies structure the internal audit group-'s reporting.docx
How do many companies structure the internal audit group-'s reporting.docxHow do many companies structure the internal audit group-'s reporting.docx
How do many companies structure the internal audit group-'s reporting.docx
 
How do semaphore relate to Petri Nets in detail-Solutionpetri nets- i.docx
How do semaphore relate to Petri Nets in detail-Solutionpetri nets-  i.docxHow do semaphore relate to Petri Nets in detail-Solutionpetri nets-  i.docx
How do semaphore relate to Petri Nets in detail-Solutionpetri nets- i.docx
 
How do you show charging by induction using a comb- or another plastic.docx
How do you show charging by induction using a comb- or another plastic.docxHow do you show charging by induction using a comb- or another plastic.docx
How do you show charging by induction using a comb- or another plastic.docx
 
How do taxes impact your accumulation-SolutionThere are three asset it.docx
How do taxes impact your accumulation-SolutionThere are three asset it.docxHow do taxes impact your accumulation-SolutionThere are three asset it.docx
How do taxes impact your accumulation-SolutionThere are three asset it.docx
 
How does sucrose and lactose react to Bial-'s test- How does sucrose.docx
How does sucrose and lactose react to Bial-'s test-  How does sucrose.docxHow does sucrose and lactose react to Bial-'s test-  How does sucrose.docx
How does sucrose and lactose react to Bial-'s test- How does sucrose.docx
 
How did the DI change in 2013SolutionCompletelly Discussion on world c.docx
How did the DI change in 2013SolutionCompletelly Discussion on world c.docxHow did the DI change in 2013SolutionCompletelly Discussion on world c.docx
How did the DI change in 2013SolutionCompletelly Discussion on world c.docx
 
How do you write dissociation equations for equilibrium and how do you.docx
How do you write dissociation equations for equilibrium and how do you.docxHow do you write dissociation equations for equilibrium and how do you.docx
How do you write dissociation equations for equilibrium and how do you.docx
 
how do I create an array in java using a for loop-Solutionimport java-.docx
how do I create an array in java using a for loop-Solutionimport java-.docxhow do I create an array in java using a for loop-Solutionimport java-.docx
how do I create an array in java using a for loop-Solutionimport java-.docx
 
how can you use pH to separate Nil) ions from Hg(I) ions- The solubili.docx
how can you use pH to separate Nil) ions from Hg(I) ions- The solubili.docxhow can you use pH to separate Nil) ions from Hg(I) ions- The solubili.docx
how can you use pH to separate Nil) ions from Hg(I) ions- The solubili.docx
 
How can you tell that a reaction happened in the double-displacement r.docx
How can you tell that a reaction happened in the double-displacement r.docxHow can you tell that a reaction happened in the double-displacement r.docx
How can you tell that a reaction happened in the double-displacement r.docx
 
How many of these symmetry elements does this complex have- E C2 -v -h.docx
How many of these symmetry elements does this complex have- E C2 -v -h.docxHow many of these symmetry elements does this complex have- E C2 -v -h.docx
How many of these symmetry elements does this complex have- E C2 -v -h.docx
 
How can you identifiy a DNS frame in wired Ethernent- 1- Is it broadca.docx
How can you identifiy a DNS frame in wired Ethernent- 1- Is it broadca.docxHow can you identifiy a DNS frame in wired Ethernent- 1- Is it broadca.docx
How can you identifiy a DNS frame in wired Ethernent- 1- Is it broadca.docx
 
How would you explain to an intelligent but non-scientifically-educate.docx
How would you explain to an intelligent but non-scientifically-educate.docxHow would you explain to an intelligent but non-scientifically-educate.docx
How would you explain to an intelligent but non-scientifically-educate.docx
 
How can you tell what kind of primary atomic bonding is present by not.docx
How can you tell what kind of primary atomic bonding is present by not.docxHow can you tell what kind of primary atomic bonding is present by not.docx
How can you tell what kind of primary atomic bonding is present by not.docx
 
How to separate the solution of ethanol- iodine- and LiNO3 How to sep.docx
How to separate the solution of ethanol- iodine- and LiNO3  How to sep.docxHow to separate the solution of ethanol- iodine- and LiNO3  How to sep.docx
How to separate the solution of ethanol- iodine- and LiNO3 How to sep.docx
 

Kürzlich hochgeladen

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
PECB
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Kürzlich hochgeladen (20)

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
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
 
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
 
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...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
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
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
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 ...
 

How many times will the following loop print hello- i - 1- while ( i.docx

  • 1. How many times will the following loop print hello? i = 1; while ( i <= 10 ) cout << "hello"; A.0. B.9. C.10. D.An infinite number of times. Solution /* if we use this code */ /* main.cpp */ #include <iostream> using namespace std; int main() { int i = 1; while ( i <= 10 ) cout << "hello"; return 0; } /* then output will be D. an infinite number of times. */ /* hello will be printed infinite number of times because value of i is not increasing means we have not used i++ in while loop */