+ 1

#include <iostream> using namespace std; int main() { for (int x=1; x<10; x++) { if (x==2){ continue; } if (x==5){ break; } cou

How many numbers will the following above loop output?

30th Dec 2022, 3:45 PM
Alex Boso Nzaphila
Alex Boso Nzaphila - avatar
12 ответов
+ 7
1. Your code is incomplete. 2. You can run it yourself in the code playground, and verify the result.
30th Dec 2022, 4:19 PM
Tibor Santa
Tibor Santa - avatar
0
cou?
30th Dec 2022, 8:06 PM
NinjaGamer
NinjaGamer - avatar
0
Alex Boso Nzaphila As Tibor suggested, if you ran the code in playground you would have the answer to your question.
31st Dec 2022, 12:14 AM
Scott D
Scott D - avatar
0
Continue; omits the following statement Break; immediately exits the statement where it is
31st Dec 2022, 11:54 PM
anónimo inc
anónimo inc - avatar
0
If you add a line like cout<<x<<endl; Then you'll get the output like: 1 3 4
1st Jan 2023, 9:24 AM
MOHAMMED ISMAIL S
0
for(int x=1;x<10;x++) { if(x == 2) { continue; } if(x == 5) { break; } cout << x << endl; }
11th Jun 2023, 11:54 AM
Zika
0
5
18th Apr 2024, 5:00 PM
Rishikumar Govindarajan
Rishikumar Govindarajan - avatar
- 1
cout<<x<<endl; } }
30th Dec 2022, 5:11 PM
Alex Boso Nzaphila
Alex Boso Nzaphila - avatar
- 1
It's not supposed to be run, its a question asked.
30th Dec 2022, 5:12 PM
Alex Boso Nzaphila
Alex Boso Nzaphila - avatar
- 1
It's incomplete code, so how it would be declare loop output.
31st Dec 2022, 12:01 PM
Bundelkhand University
Bundelkhand University - avatar
- 1
Three if we don't look at the syntax mistakes :)
1st Jan 2023, 1:07 PM
Rob
- 1
Thanks Rob
1st Jan 2023, 1:49 PM
Alex Boso Nzaphila
Alex Boso Nzaphila - avatar