From d0d40d405f869b81cdb8a2a52e9d644425b31b72 Mon Sep 17 00:00:00 2001 From: Ishita Date: Thu, 27 May 2021 00:22:03 +0530 Subject: [PATCH] Tower of Hanoi #84 --- TOH.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 TOH.c diff --git a/TOH.c b/TOH.c new file mode 100644 index 0000000..17a5696 --- /dev/null +++ b/TOH.c @@ -0,0 +1,12 @@ +#include +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'); +} \ No newline at end of file