- 3

What is the code of this output

11112 2223 334 45 5 Loops in c++

25th Oct 2022, 5:07 AM
Bacani Rocelle M.
Bacani Rocelle M. - avatar
10 Answers
+ 2
Thanks for the idea
25th Oct 2022, 12:09 PM
Bacani Rocelle M.
Bacani Rocelle M. - avatar
+ 1
Thank you so much AJ have a great night
25th Oct 2022, 12:59 PM
Bacani Rocelle M.
Bacani Rocelle M. - avatar
0
Can you post your attempt?
25th Oct 2022, 5:40 AM
KrOW
KrOW - avatar
0
#include <iostream> using namespace std; int main() { int x=0; for(int i=5;i>0;) { if(x<i) {cout<<"1"; x++; continue;} cout<<endl; i--; x=0; } return 0; }
25th Oct 2022, 5:43 AM
Bacani Rocelle M.
Bacani Rocelle M. - avatar
0
Can anyone help me
25th Oct 2022, 8:18 AM
Bacani Rocelle M.
Bacani Rocelle M. - avatar
0
Bacani Rocelle M. Just a little change, played with a variable instead of hard code value https://code.sololearn.com/c1tvTXVRSgV7/?ref=app
25th Oct 2022, 8:34 AM
A͢J
A͢J - avatar
0
AJ can you help to learn looping this code is a little bit hard for me im still learning loopings
25th Oct 2022, 12:16 PM
Bacani Rocelle M.
Bacani Rocelle M. - avatar
0
This is my while loops can you do a do while
25th Oct 2022, 12:20 PM
Bacani Rocelle M.
Bacani Rocelle M. - avatar
0
#include <iostream> #include <conio.h> using namespace std; int main () { int x=1; while (x<=4) { int y=4; while (y>=x) { cout<< x; y--; } x++; cout<<x; cout<<endl; } cout<<x; getch (); return 0; }
25th Oct 2022, 12:20 PM
Bacani Rocelle M.
Bacani Rocelle M. - avatar
0
Bacani Rocelle M. It is simple just put first while later and replace with do #include <iostream> using namespace std; int main () { int x=1; do//updated { int y=4; while (y>=x) { cout<< x; y--; } x++; cout<<x; cout<<endl; } while (x<=4); //added cout<<x; return 0; }
25th Oct 2022, 12:57 PM
A͢J
A͢J - avatar