Code:
#include <stdio.h>
#include <conio.h>

void diskchange(char l,char r,char c,int n)
{
	if(n>0)
	{
		diskchange(l,c,r,n-1);
		printf("\nMove %d from %c to %c\n",n,l,r);
		diskchange(c,r,l,n-1);
	}
}

int main()
{
	int n;
	printf("\nEnter the number of disks\n");
	scanf("%d",&n);

	diskchange('L','R','C',n);
	printf("\nPress any key to exit\n");
	getch();

	return 0;
}