- 1

What will be the values of x and y after execution and how many times the loop will execute? Can someone explain step by step?

What will be the values of x and y after execution and how many times the loop will execute? Can someone explain step by step? $x=0; $y=0 for($x=1; $x<=5; ++$x) $y= $x++; --$y;

26th Feb 2018, 6:42 PM
Sarbjot Kaur
Sarbjot Kaur - avatar
6 Réponses
+ 9
1
16th Dec 2020, 8:51 AM
NUR AZWA SAFRINA BINTI FAZIL
NUR AZWA SAFRINA BINTI FAZIL - avatar
+ 7
@@Sarbjot Kaur, i have created one program on this and i think this one cleared your all doubt check this at once thank you https://code.sololearn.com/wV1FN37JHTxq/?ref=app
3rd Mar 2018, 10:33 PM
ASIF BILAKHIYA
ASIF BILAKHIYA - avatar
+ 3
how this answer came?
27th Feb 2018, 4:15 AM
Sarbjot Kaur
Sarbjot Kaur - avatar
+ 1
syntax errors that's for sure. $x=0; $y=0; for($x=1; $x<=5; ++$x) { $y= $x++; } --$y; It will loop 4 y is 4 and x is 7
26th Feb 2018, 8:19 PM
Toni Isotalo
Toni Isotalo - avatar
0
are you still looking for this answer?
4th Mar 2018, 1:46 PM
srividya
0
the answer is 1
28th Jan 2022, 2:05 PM
Nanda Naufal Prayasdewo