Skip to content

Commit

Permalink
Tower of Hanoi CodXCrypt#84
Browse files Browse the repository at this point in the history
  • Loading branch information
ishitakapoor26 committed May 26, 2021
1 parent e98593a commit d0d40d4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions TOH.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include<stdio.h>
void TOH(int n,char x,char y,char z) {
if(n>0) {
TOH(n-1,x,z,y);
printf("\n%c to %c",x,y);
TOH(n-1,z,y,x);
}
}
int main() {
int n=3;
TOH(n,'A','B','C');
}

0 comments on commit d0d40d4

Please sign in to comment.