:?: I got this far....but its not giving me the required output....can you give me some directions....here are my codes....thanks....please refer to my pdf file for the question.
//import java.lang.*;
import java.math.*;
import java.io.*;
class MatMulti extends Thread
{
static int in1[][];
static int in2[][];
static int out[][];
static int n=2;
int row;
MatMulti(int i)
{
row=i;
this.start();
}
public void run()
{
int i,j;
for(i=0;i<n;i++)
{
out[row]=0;
for(j=0;j<n;j++)
out[row]=out[row]+in1[row][j]*in2[j];
}
}
public static void main(String args[])
{
int i,j;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the order of Matrix A : ");
try
{
n=Integer.parseInt(br.readLine());
}catch(Exception e){}
in1=new int[n][n];
in2=new int[n][n];
out=new int[n][n];
System.out.println("Enter the First Matrix : ");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
try
{
in1[j]=Integer.parseInt(br.readLine());
}catch(Exception e){}
}
}
System.out.println("Enter the Second Matrix : ");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
try
{
in2[j]=Integer.parseInt(br.readLine());
}catch(Exception e){}
}
}
MatMulti mat[]=new MatMulti[n];
for(i=0;i<n;i++)
mat=new MatMulti(i);
try
{
for(i=0;i<n;i++)
mat.join();
}catch(Exception e){}
System.out.println("OUTPUT :");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
System.out.println(out[j]);
}
}
rush88
0
Newbie Poster
Recommended Answers
Jump to PostTell us what it is you think you need to do with this code, and try to solve it yourself. you should just put the small snippet of code that shows how you would like to solve the problem, then we can help you.
Also, put your code within …
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.