Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@manish-r2Hoep • Dec 21, 2009
#include <stdio.h> #include <stdlib.h> int main() { int n, x; printf( "How many disks? " ); scanf( "%d", &n ); printf("\n"); for (x=1; x < (1 << n); x++) printf( "move from tower %i to tower %i.\n", (x&x-1)%3, ((x|x-1)+1)%3 ); return 0; }This is not my creation ..hope it will help you -
@sarveshgupta-txtmu5 • Dec 21, 2009
thanks a lot goyal
But you are sure that it will work! so can i use it directly without checking as i have the exam tomorrow itself
Also can you explain it a little bit what is the code doing by taking an example of 3 disks -
@manish-r2Hoep • Dec 21, 2009
sorry ...i can't explain you..but i am sure it will work...I have tested it...
as it is not created by me...... -
@sarveshgupta-txtmu5 • Dec 21, 2009
Ok thanks a lot ! 😁