Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Views: 3731
1
public class hanoi{
2
3
4
public static void bewege(int n, boolean left){
5
6
if (n==0)
7
return;
8
9
bewege (n-1, !left);
10
11
if (left)
12
System.out.println(n+"left");
13
14
15
else
16
System.out.println(n+ "right");
17
bewege(n-1, !left);
18
}
19
20
21
public static void main(String[] args) {
22
int n=3; // Anzahl der Scheiben
23
bewege(n,true);
24
}
25
}
26
27
28