Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Data File StructureRSS Feeds

Program of hanoi tower in dfs

Posted By: Agatha Miller     Category: C Programming     Views: 3429

Program of hanoi tower in dfs.

Code for Program of hanoi tower in dfs in C Programming

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

void main()
{
  int n;
  int hanoi(int,char,char,char);
  clrscr();
  printf("Enter  the no of disk:");
  scanf("%d",&n);
  hanoi(n,'a','b','c');
  getch();
}
int hanoi(int n,char a, char b, char c)
{
while(n!=0)
{
hanoi(n-1,a,c,b);
printf("Moving disk %d from %c tower to %c tower\n",n,a,c);
hanoi(n-1,b,a,c);
break;
}
return 0;

}
  
Share: 


Didn't find what you were looking for? Find more on Program of hanoi tower in dfs Or get search suggestion and latest updates.

Agatha Miller
Agatha Miller author of Program of hanoi tower in dfs is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!