+ 1
why m getting hearts and I in the output of this program of tower of hanoi
#include<stdio.h> #include<conio.h> void tof(int n,char source,char temp,char dest); void main() { int n; /* n is the no. of disks*/ char a,b,c; //source is a,temp is b, dest is c printf("enter the no. of disks\n"); scanf("%d",&n); tof(n,a,b,c); getch(); } void tof(int n,char source,char temp,char dest) { if(n==1) { printf("move the disk %d from %c to %c\n",n,source,dest); return; } tof(n-1,source,dest,temp); printf("move %d disks from %c to %c\n",n,source,dest); tof(n-1,temp,source,dest); }
2 odpowiedzi
+ 2
what does this program do
0
it solves tower of hanoi