ALL > Computer and Education > courses > university courses > undergraduate courses > An Overview of Computer Science > 2017-2018-1 class > student homework directory >
Homework-5(Karina) Version 0
👤 Author: by karabalinakarinaicloudcom 2017-12-25 08:28:32
# include <stdio.h>

void hanoi ( int n, char a, char b, char c )

{

if (n==1)

{printf(\"%c-->%c\\n\",a,c);}

else

{

hanoi ( n-1, a, c, b ) ;

printf(\"%c-->%c\\n\",a , c) ;

hanoi ( n-1, b, a, c ) ;

}

}

int main ()

{

int n ;

printf( \"Input the number of disks:\") ;

scanf(\"%d\",&n) ;

hanoi ( n, \'A\' , \'B\' , \'C\' ) ;

return 0;

}

Please login to reply. Login

Reversion History

Loading...
No reversions found.