Hallo,
Leute bin wieder dabei eine Matrix mal Matrix über eine while Schleife zu machen! Bekomme es aber net hin!
Leute bin wieder dabei eine Matrix mal Matrix über eine while Schleife zu machen! Bekomme es aber net hin!
Java:
public class MatrixWhile {
public static double [][] compute (double [][] a , double [][] b){
double [][] erg = new double [a.length][a.length];
int i=0;
int j=0;
int k=0;
while (i<a.length){
while (j<a.length){
while (k<a.length){
erg [i][j] += a[i][k] * b[k][j];
}
System.out.print(erg[i][j] + " ");
j++;
}
System.out.println(" ");
i++;
}
return erg;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
double [][] a = {{1,2}, {2,1}};
double [][] b = {{2,1}, {3,4}};
MatrixWhile.compute(a, b);
}
}