Professional Documents
Culture Documents
First 4 Programs Algorithms
First 4 Programs Algorithms
First 4 Programs Algorithms
Program 1. To find the greatest common divisor (GCD) for two numbers by using the
recursive function.
Step 1. Start
step2. take n as number of disk
step 3. call the function of hanoi(n from, via to)
step 4. in n==1
step 5. move disk from source to destination
step 6. else hanoi(n-1,from,to,via)
step 7. move disk from source to destination
step 8. hanoi(n-1, via, from, to)
step 8. return to main
step 9. stop