šiven the codes: 1 include 2 using namespace std; 3 4 int main () 5 { 6. { for (int i=0; i<10; i++) 7 8. if(i==4) 9. 10 break; cout << i « "\n"; } return 0; 15 } 16 3456 H11 11 1

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter4: Making Decisions
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question
Given the codes:
1 include <iostream>
2 using namespace std;
3
4
int main ()
5 {
for (int i=0; i<10; i++)
7
{
if (i==4)
8
{
10
break;
11
}
12
cout << i < "\n";
13
14
return 0;
15
}
16
Trace the output for the program above.
ii.
If 'break' is replaced with 'continue', give the output of execution and explain the
differences.
Transcribed Image Text:Given the codes: 1 include <iostream> 2 using namespace std; 3 4 int main () 5 { for (int i=0; i<10; i++) 7 { if (i==4) 8 { 10 break; 11 } 12 cout << i < "\n"; 13 14 return 0; 15 } 16 Trace the output for the program above. ii. If 'break' is replaced with 'continue', give the output of execution and explain the differences.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Declaring and Defining the Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage