بسم الله
السلام عليكم
لو سمحتم ممكن حد يخبرني أين أخطأت في هذا البرنامج وهو برنامج صممته لضرب مصفوفتين تقوم بإدخال أبعاد المصفوفتين ثم تعين عناصر كل مصفوفة فيخرج لك حاصل ضربهماوقد جعلت إدخال عدد أعمدة الأولي هونفسه عدد صفوف الثانية حتي لا يحدث خطأ
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package array;
import javax.swing.*;
/**
*
* @author Abuoof
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int x=Integer.parseInt(JOptionPane.showInputDialog(null,"Enter Number Of Raws In THe First Array","combinations",JOptionPane.QUESTION_MESSAGE));
int y=Integer.parseInt(JOptionPane.showInputDialog(null,"Enter Number Of Columns In THe First Array And The Number Of Raws In Second Array","combinations",JOptionPane.QUESTION_MESSAGE));
int w=Integer.parseInt(JOptionPane.showInputDialog(null,"Enter Number Of Columns In THe Second Array","combinations",JOptionPane.QUESTION_MESSAGE));
int result[][]=new int [x][w];
int A=0,B=0;
int i,j,m,n;
String output = "The Result Is \n";
int[][]first=new int[x][y];
for(i=0;i<x;i++) {
for(j=0;j<y;j++)
{
int p=Integer.parseInt(JOptionPane.showInputDialog(null,"Enter("+i+","+j+")In The Frist Array" ,"combinations",JOptionPane.QUESTION_MESSAGE));
first[j]=p;
}}
int[][]second=new int [y][w];
for(n=0;n<y;n++) {
for(m=0;m<w;m++){
int q=Integer.parseInt(JOptionPane.showInputDialog(null,"Enter("+n+","+m+")In The Second Array","combinations",JOptionPane.QUESTION_MESSAGE));
second[n][m]=q;
}}
for(A=0;A<x;A++){
for(B=0;B<w;B++){
for(i=0;i<x;i++) {
for (n=i;n<w;n++){
for(j=B;j<=w;j++){
for (m=j;m<=j;m++){
result[A]+=((first[j])*(second[n][m]));
}
}
output += result[A] + " ";
}}
}
output += "\n";}
JOptionPane.showMessageDialog(null, output);
}
}وجزاكم الله خير