+ 2

My number pattern code doesn't give me the required answer

My code works fine in code blocks but gives me wrong answer in SoloLearn. What might be the problem? https://code.sololearn.com/cTSnZR5YA09h/?ref=app

25th Mar 2020, 8:36 PM
Daniel Dankwah
Daniel Dankwah - avatar
3 Answers
0
Your code is fine but Infinite loop because of this for(int b=0; a<=5; b++) { Here your checking a<=5 and incrementing b a is always 0 so Infinite loop...
25th Mar 2020, 8:47 PM
Jayakrishna 🇼🇳
+ 3
Thanks to all. Now my code works fine
25th Mar 2020, 8:52 PM
Daniel Dankwah
Daniel Dankwah - avatar
+ 1
b <= 5 in line no 6
25th Mar 2020, 8:47 PM
Saad Saleem
Saad Saleem - avatar