Tower of Hanoi

Share it Please
/*PROGRAMMER: SOJITRA AADARSH H
 *DATE: 23/09/2013
 *E-MAIL: adarshsojitra@gmail.com*/
#include<stdio.h>
#include<conio.h>
void tower(int,char,char,char);
main()
{
int n;
clrscr();
printf("Enter the number of disks: ");
scanf("%d",&n);
tower(n,'A','C','B');
getch();
return 0;
}
void tower(int n,char from,char to,char aux)
{
if(n==1)
{
printf("Move disk 1 from peg %c to peg %c",from,to);
return;
}
tower(n-1,from,aux,to);
printf("\nMove disk %d from peg %c to peg %c\n",n,from,to,aux);
tower(n-1,aux,to,from);
}