+ 4

How i solve this code??

1 2 3 4 4 5 6 7 7 7 8 9 10 10 11 12 13 13 13 14 15 16 16 17 18 19 19

15th Mar 2018, 2:27 PM
Mahmod Al-ajarma
Mahmod Al-ajarma - avatar
3 Answers
+ 7
#include <iostream> using namespace std; int main() { int x = 1; for(int i=1;i<=6;i++) { if(i%2==0) for(int j=1;j<=5;j++) { cout<<x<<" "; if(j<4) x++;} else for(int j=1;j<=4;j++) { cout<<x<<" "; if(j<4) x++;} cout<<"\n"; } return 0; }
15th Mar 2018, 3:31 PM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
+ 3
please help me
15th Mar 2018, 2:27 PM
Mahmod Al-ajarma
Mahmod Al-ajarma - avatar
+ 1
thanks
15th Mar 2018, 3:32 PM
Mahmod Al-ajarma
Mahmod Al-ajarma - avatar