Code Id | 36 | |
---|---|---|
Date Updated | 3/7/2010 | |
Title | Tower of Hanoi | |
Description | ||
This program implements Tower of Hanoi. This has a historical basis in the historial basis in the ritual of the ancient Tower of Brahma. |
||
Codes Snippet | ||
#include void Hanoi (int n, char initial, char final, char temp) { if (n==1) printf(�Move disk � 1 from %c to %c n�, initial, final); return; Hanoi (n � 1, initial, temp, final); printf(�Move disk � %d from %c to %c n�, n, initial, final); Hanoi (n � 1, temp, final, initial); } void main() { int n; printf(�Enter no. of disks to be moved�); scanf(�%d�,&n); Hanoi(n,�A�,�C�,�B�); } |
Online Enquiry
Course Registration
-
Recent Posts