/* Towers of Hanoi program */

#include <stdio.h>

void move (int disk, int a, int c, int b);

int main()
{
  int n;
  printf ("How many disks?  ");
  scanf ("%d", &n);
  printf ("\n");

  move (n, 1, 3, 2);

  return 0;
}

/* PRE:  n >= 0
         a, b, and c represent some order of the distinct integers 1, 2, 3
   POST: the function displays the individual moves necessary
         to move n disks from needle a to needle c, using needle b
         as a temporary storage needle
*/

void move (int disk, int a, int c, int b)
{
  if (disk > 0)
    {
      move (disk-1, a, b, c);
      printf ("Move one disk from %d to %d\n", a, c);
      move (disk-1, b, c, a);
    }

  return;
}



