+ 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??
6 Respostas
+ 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.
+ 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;
}
0
you say reverse is it means 1234=-1234
0
it means 1234=4321
0
thanx it helps alot
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