Observe the following coding in java. Can you find the number of times "yo yo honey singh" will be displayed?
1 2 3 4 |
|
Log on to www.comprogzz.in for more such java coding:))
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
i is initialized with a value 0 in condition i--<=5 n update is i++ 1st time i=0,(i--) -1<=5 loop executes then i++ makes i=0 but in 2nd execution of the loop i-- again makes i=-1 thus value of i is always -1 due to i-- n 0 due to i++ hence it executes infinitely