#include <stdio.h>
//tabee
//disk ha az mileye Mil1 be mileye Mil2 be komake Mil3 jabeja shavand.
void Hanoi (int d, int Mil1, int Mil2, int Mil3)
{
	if (d == 1)
		printf ("1 disk az mileye %d be mileye %d\n", Mil1, Mil2);
	else
	{
		Hanoi (d-1, Mil1, Mil3, Mil2);
		printf ("1 disk az mileye %d be mileye %d\n", Mil1, Mil2);
		Hanoi (d-1, Mil3, Mil2, Mil1);
	}
}

int main ()
{
	int DiskNums;
	printf ("\nTedade Disk = ");
	scanf("%d", &DiskNums);
	if(DiskNums == 1)
		printf ("disk az mileye 1 be mileye 2\n");
	else
	{
		Hanoi(DiskNums - 1, 1, 3, 2);
		Hanoi(1, 1, 2, 3);
		Hanoi(DiskNums - 1, 3, 2, 1);
	}
	getch();
}

