+ 2

Playground failed questions explainer

could there be a brief explanation of questions that we fail on playground, some are quite challenging and it will be nice if the answers are explained

28th May 2019, 6:03 PM
James Mbatia
James Mbatia - avatar
8 odpowiedzi
+ 4
and yes Jim Mbatia you have missed to replace greater than operator in for loop condition for ($i=0; $i<5; $i++) Firstly 5025 is concatenate answer of a and b for in which a=50 and b=25 now that is because loop is running from 0 to 5 excluding 5 means for 0,1,2,3,4 means 5 time the loop will run and execute it body $a is 0 initiallyn and when it goes inside the loop first time incremented by 10 so after 5 time going 10+10+10+10+10=50 that's why $a =50 same with $b goes 5 times in loop and increment by 5 five times so $b= 5+5+5+5+5=25 so concatenate answer is 5025 after 5 times the loop condition will be false and out of the loop and print 5025 as output I hope it is clear now have some 🍎 🍎
28th May 2019, 6:27 PM
DishaAhuja
DishaAhuja - avatar
+ 5
You can put the code here or screenshot here and I'll answer for sure You can upload screen shot on any online site like dropbox or drive then paste the link here You will get the full explanation:-P Have some 🍎 🍎 🍎
28th May 2019, 6:06 PM
DishaAhuja
DishaAhuja - avatar
+ 3
Welcome :-D I'm honoured have some more 🍎 🍎 🍎 ping me if you needed any help
28th May 2019, 6:34 PM
DishaAhuja
DishaAhuja - avatar
+ 2
What is the output of this code? $a=0; $b=0; For ($i=0; $i>5; $i++){ $a+=10; $b+=5; } echo ("$a$b");
28th May 2019, 6:21 PM
James Mbatia
James Mbatia - avatar
+ 2
You are the best
28th May 2019, 6:38 PM
James Mbatia
James Mbatia - avatar
+ 1
Thanks Disha Ahuja for that reply. I have now posted the question the answer is 5025 but I didn't get why
28th May 2019, 6:24 PM
James Mbatia
James Mbatia - avatar
+ 1
Wow! Thanks I got it now
28th May 2019, 6:30 PM
James Mbatia
James Mbatia - avatar
+ 1
Yeah it should be < DishaAhuja . Thanks you
28th May 2019, 6:33 PM
James Mbatia
James Mbatia - avatar