diff --git a/ExtraDSAQ/tower of hanoi.c b/ExtraDSAQ/tower of hanoi.c new file mode 100644 index 0000000..1c0feee --- /dev/null +++ b/ExtraDSAQ/tower of hanoi.c @@ -0,0 +1,15 @@ +#include +int TOH(int n,int A,int B,int C) +{ + if(n>0) + { + TOH(n-1,A,C,B); + printf("(%d,%d)",A,C); + TOH(n-1,B,A,C); + } +} +int main() +{ + TOH(3,1,2,3); + return 0; +}