From 06da42e14fcc4e9ad41fd9ef9512890011cde982 Mon Sep 17 00:00:00 2001 From: AnupKumarPanwar <1anuppanwar@gmail.com> Date: Tue, 3 Oct 2017 16:42:16 +0530 Subject: [PATCH] Moved TowerOfHanoi.c to misc --- TowerOfHanoi.c => misc/TowerOfHanoi.c | 58 +++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) rename TowerOfHanoi.c => misc/TowerOfHanoi.c (94%) diff --git a/TowerOfHanoi.c b/misc/TowerOfHanoi.c similarity index 94% rename from TowerOfHanoi.c rename to misc/TowerOfHanoi.c index ab13d030..3568ccd0 100644 --- a/TowerOfHanoi.c +++ b/misc/TowerOfHanoi.c @@ -1,29 +1,29 @@ - -#include -#include - -// Function for Tower of Hanoi algorithm -void hanoi(int noOfDisks,char where,char to,char extra){ - if(noOfDisks == 0 ) - { - return; - } - else - { - hanoi(noOfDisks-1, where, extra , to); - printf("Move disk : %d from %c to %c\n",noOfDisks,where,to); - hanoi(noOfDisks-1,extra,to,where); - } -} -int main(void){ - int noOfDisks; - - //Asks the number of disks in the tower - printf("Number of disks: \n"); - scanf("%d", &noOfDisks); - - hanoi(noOfDisks,'A','B','C'); - - return 0; - -} + +#include +#include + +// Function for Tower of Hanoi algorithm +void hanoi(int noOfDisks,char where,char to,char extra){ + if(noOfDisks == 0 ) + { + return; + } + else + { + hanoi(noOfDisks-1, where, extra , to); + printf("Move disk : %d from %c to %c\n",noOfDisks,where,to); + hanoi(noOfDisks-1,extra,to,where); + } +} +int main(void){ + int noOfDisks; + + //Asks the number of disks in the tower + printf("Number of disks: \n"); + scanf("%d", &noOfDisks); + + hanoi(noOfDisks,'A','B','C'); + + return 0; + +}