public static void hanoi(int n,char from,char to,char via){
if (n == 1){
System.out.println("move ring from "+from+" to "+to);
}
else{
hanoi(n-1 ,from,via,to);
System.out.println("move ring from "+from+" to "+to);
hanoi(n-1,via,to,from);
}
}
public static void hanoi(int n,char from,char to,char via){
if (n == 1){
System.out.println("move ring from "+from+" to "+to);
}
else{
hanoi(n-1 ,from,via,to);
System.out.println("move ring from "+from+" to "+to);
hanoi(n-1,via,to,from);
}
}