+ 1

Is it possible to reverse 4 or 5 degit numbers using for{} loop.. i did it using while{}loop..is it possible with for{} loop??

23rd Feb 2017, 9:33 AM
JITENDRA MAURYA
JITENDRA MAURYA - avatar
6 odpowiedzi
+ 3
While, Do While, For loops can be converted into one another. If you can do something with one of these, you can do it with the other two.
23rd Feb 2017, 11:24 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 2
every while loop can be converted to equivalent for loop n vice versa. rev = 0; for(i=n;i>0;i/=10){ digit = i%10; rev = rev*10+digit; }
23rd Feb 2017, 10:56 AM
Sizr
Sizr - avatar
0
you say reverse is it means 1234=-1234
23rd Feb 2017, 9:40 AM
Zia Khan
Zia Khan - avatar
0
it means 1234=4321
23rd Feb 2017, 9:52 AM
JITENDRA MAURYA
JITENDRA MAURYA - avatar
0
thanx it helps alot
23rd Feb 2017, 11:03 AM
JITENDRA MAURYA
JITENDRA MAURYA - avatar
0
do while loop is little different it is post check loop, for n while both are pre check loops. they can be transferred into one another though but just with little trick extra for do while loops. for n while are just pure n simple translations
23rd Feb 2017, 11:27 AM
Sizr
Sizr - avatar