if you are interested to contribute your LAB PROGRAM Please send mail to jkumaron@gmail.com

While statement condition with decrease variable| while statement condition different format

While condition in the decrease variable in the every loop. Is it possible?
What is counter value?
Debugging Answer:
Debugging solution:
Whenever it will enter in to the while loop it must statisfy there while loop condition
In these case it will enter the loop till for the sw=2,when it become sw=1
Then while((sw-1)) 1-1=0.so while loop become false .so it does not enter the while loop.
Sw=3 counter=1
Sw=2 counter =2
So the final counter value is 2

Related post