[Plain]
# Include <stdio. h>
Void hanol (int num, char a, char B, char c );
Int main ()
{
Int num;
Char a = 'a ';
Char B = 'B ';
Char c = 'C ';
Printf ("please enter a number :");
Scanf ("% d", & num );
Hanol (num, a, B, c );
Return 0;
}
Void hanol (int num, char a, char B, char c)
{
If (num = 1)
{
Printf ("Move disk % d from % c to % c \ n", num, a, c );
}
Else
{
Hanol (num-1, a, c, B );
Printf ("Move disk % d from % c to % c \ n", num, a, c );
Hanol (num-1, B, a, c );
}
}
# Include <stdio. h>
Void hanol (int num, char a, char B, char c );
Int main ()
{
Int num;
Char a = 'a ';
Char B = 'B ';
Char c = 'C ';
Printf ("please enter a number :");
Scanf ("% d", & num );
Hanol (num, a, B, c );
Return 0;
}
Void hanol (int num, char a, char B, char c)
{
If (num = 1)
{
Printf ("Move disk % d from % c to % c \ n", num, a, c );
}
Else
{
Hanol (num-1, a, c, B );
Printf ("Move disk % d from % c to % c \ n", num, a, c );
Hanol (num-1, B, a, c );
}
}