mirror of
https://github.com/DerTyp7/lf05-java.git
synced 2025-10-29 20:42:11 +01:00
Create Wuerfeln.java
This commit is contained in:
27
src/zweidimnesionaleArrays/Wuerfeln.java
Normal file
27
src/zweidimnesionaleArrays/Wuerfeln.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package zweidimnesionaleArrays;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
public class Wuerfeln {
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
int anzahlWuerfe = 10;
|
||||||
|
int anzahlExperimente = 4;
|
||||||
|
int[][] wuerfe = new int[anzahlExperimente][anzahlWuerfe];
|
||||||
|
|
||||||
|
for(int i = 0; i < anzahlExperimente; i++){
|
||||||
|
for(int a = 0; a < anzahlWuerfe; a++){
|
||||||
|
wuerfe[i][a] = (int)(Math.random()*6)+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for(int i = 0; i < anzahlExperimente; i++){
|
||||||
|
for(int a = 0; a < anzahlWuerfe; a++){
|
||||||
|
System.out.print(wuerfe[i][a] +" ");
|
||||||
|
}
|
||||||
|
System.out.print("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user