Exemplo n.º 1
0
void tofh(int ndisk,char source,char temp,char dest)
{
if(n disk==1)
{
printf("move disk %d from %c--->%c\n",ndisk,source,dest);
return;
}
tofh(n disk-1,source,dest,temp)
printf("move disk%d from%c--->%c\n",ndisk,source,dest);
tofh(ndisk-1,temp,source dest);
}
Exemplo n.º 2
0
void tofh(int ndisk, char source, char temp, char dest)
{
    if(ndisk==1)
    {
        printf("Move Disk %d from %c-->%c\n", ndisk, source, dest);
        return;
    }
    tofh(ndisk-1, source, dest, temp);
    printf("Move Disk %d from %c-->%c\n", ndisk, source, dest);
    tofh(ndisk-1, temp, source, dest);

}/*End of tofh( )*/
Exemplo n.º 3
0
main( )
{
    char  source = 'A', temp = 'B', dest = 'C';
    int ndisk;
    printf("Enter the number of disks : ");
    scanf("%d", &ndisk );
    printf("Sequence is :\n");
    tofh(ndisk, source, temp, dest);
}/*End of main()*/
Exemplo n.º 4
0
int main()
{
char source='a',temp='b',dest='c';
int disk;
printf("enter the no of disk:");
scanf("%d",&disk);
printf("sequence is:\n");
tofh(n disk,source,temp,dest);
return 0:
}