Java:2eme matrice s'affiche pas
Résolu
domxaline
-
domxaline -
domxaline -
Bonjour,
resultat de ce programm est suivante:
Matrix 1:
567
489
Matrix 2:000
000
000
Multiply of both matrix:
6769
7381
vous voyez la deuxième matrice s'affiche pas
aidez moi pourquoi s'affiche pas?
public class MatrixMultiply { public static void main(String[]args) { int array[][]={{5,6,7},{4,8,9}}; int array1[][]={{6,4},{5,7},{1,1}}; int array2[][]=new int[3][3]; int x=array.length; System.out.println("Matrix 1:"); for(int i=0;i<x;i++) { for(int j=0;j<=x;j++) { System.out.print(""+array[i][j]); } System.out.println(); } int y=array1.length; System.out.print("Matrix 2:"); for(int i=0;i<y;i++) { for(int j=0;j<=y-1;j++) { System.out.print(""+array2[i][j]); } System.out.println(); } for(int i=0;i<x;i++) { for(int j=0;j<y-1;j++) { for(int k=0;k<y;k++) { array2[i][j]+=array[i][k]*array1[k][j]; } } } System.out.println("Multiply of both matrix:"); for(int i=0;i<x;i++) { for(int j=0;j<y-1;j++) { System.out.print(""+array2[i][j]); } System.out.println(); } }}
resultat de ce programm est suivante:
Matrix 1:
567
489
Matrix 2:000
000
000
Multiply of both matrix:
6769
7381
vous voyez la deuxième matrice s'affiche pas
aidez moi pourquoi s'affiche pas?
A voir également:
- Java:2eme matrice s'affiche pas
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux java itel - Télécharger - Jeux vidéo
- Eclipse java - Télécharger - Langages
- Java apk - Télécharger - Langages
- Waptrick java voiture - Télécharger - Jeux vidéo
2 réponses
bonjour
je sais il y a une pb partie suiivante
aidez moi,pourquoi mon deuxième matrice s'affiche que des zeros
Matrix 1:
567
489
Multiply of both matrix:
6769
7381
je sais il y a une pb partie suiivante
System.out.print("Matrix 2:"); for(int i=0;i<y;i++) { //for(int j=1;j<=y-1;j++) for(int j=0;j<=y-1;j++) { //System.out.print(""+array2[i][j]); System.out.print(""+array2[i][j]); } System.out.println(); }
aidez moi,pourquoi mon deuxième matrice s'affiche que des zeros
Matrix 1:
567
489
Matrix 2:000 000 000
Multiply of both matrix:
6769
7381