Tower of Hanoi C Source Code

#include "stdio.h"
#include "conio.h"

void move(int count, char from, char temp, char to)
{
     if (count == 0)
     {
        return;
     }
     else
     {
         move(count - 1, from, to, temp);
         printf("From : %c To : %cn", from, to);
         move(count - 1, temp, from, to);
     }
}

int main()
{
	int count;
    printf("How Many Plates? : ");
   	scanf("%d", &count);
   	move(count,'A','B','C');
	getch();
	return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation