scream4040
Grünschnabel
Hallo zusammen komme im moment nihct weiter und brauche eure Hilfe bei der Darstellung der Zahlen
Moment das Programm was ich habe stellt es so dar
1 2 3 4
2 4 6 8
3 6 9 12
4 8 12 16
Die Darstellung soll aber so erfolgen
* 1 2 3 4
1 1 2 3 4
2 2 4 6 8
3 3 6 9 12
4 4 8 12 16
nun daher das was ich bis jetzt habe
public static void main(String[] args) {
int dim,a,b;
//a=Zahlen
a=Integer.parseInt(args[0]);
//b=Länge
b=Integer.parseInt(args[1]);
//dimension
dim=Integer.parseInt(args[2]);
for ( a = 1; a <= dim; a++) {
String line = "";
for ( b = 1; b <= dim;b++) {
line = line + a*b + "\t";
}
System.out.println("\t"+line);
}
}
Moment das Programm was ich habe stellt es so dar
1 2 3 4
2 4 6 8
3 6 9 12
4 8 12 16
Die Darstellung soll aber so erfolgen
* 1 2 3 4
1 1 2 3 4
2 2 4 6 8
3 3 6 9 12
4 4 8 12 16
nun daher das was ich bis jetzt habe
public static void main(String[] args) {
int dim,a,b;
//a=Zahlen
a=Integer.parseInt(args[0]);
//b=Länge
b=Integer.parseInt(args[1]);
//dimension
dim=Integer.parseInt(args[2]);
for ( a = 1; a <= dim; a++) {
String line = "";
for ( b = 1; b <= dim;b++) {
line = line + a*b + "\t";
}
System.out.println("\t"+line);
}
}