From 74c091b1aa3ecb42733df0a5fc234ccfb4d5e70d Mon Sep 17 00:00:00 2001 From: shellhub Date: Tue, 30 Jun 2020 16:27:19 +0800 Subject: [PATCH] less code --- misc/tower_of_hanoi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/misc/tower_of_hanoi.c b/misc/tower_of_hanoi.c index 59666a67..e0b55d43 100644 --- a/misc/tower_of_hanoi.c +++ b/misc/tower_of_hanoi.c @@ -5,11 +5,7 @@ // Function for Tower of Hanoi algorithm void hanoi(int noOfDisks, char where, char to, char extra) { - if (noOfDisks == 0) - { - return; - } - else + if (noOfDisks != 0) { hanoi(noOfDisks - 1, where, extra, to); printf("Move disk : %d from %c to %c\n", noOfDisks, where, to);