answersLogoWhite

0

//Matrix multiplication import java.util.Scanner; public class Matrix

{

public static void main(String args[])

{

Scanner s= new Scanner(System.in);

int i,j,k; System.out.println("enter the value of n"); int n=s.nextInt(); int a[][]=new int[n][n]; int b[][]=new int[n][n]; int c[][]=new int[n][n]; System.out.println("enter the array elements of a:"); for(i=0;i<n;i++)

{

for(j=0;j<n;j++)

{

a[i][j]=s.nextInt();

}

}//end of a matrix System.out.println("enter the array elements of b:"); for(i=0;i<n;i++)

{

for(j=0;j<n;j++)

{

b[i][j]=s.nextInt();

}

}//end of b matrix System.out.println("the result matrix is:");

for(i=0;i<n;i++)

{

for(j=0;j<n;j++)

{

for(k=0;k<n;k++)

{ c[i][j]+=a[i][k]*b[k][j]; }

}

} for(i=0;i<n;i++)

{

for(j=0;j<n;j++)

{

System.out.print(+c[i][j]);

}System.out.println();

}

}//end of main

}//end of class

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

How do you develop a JAVA program that computes matrices?

Matrices can't be "computed" as such; only operations like multiplication, transpose, addition, subtraction, etc., can be done. What can be computed are determinants. If you want to write a program that does operations such as these on matrices, I suggest using a two-dimensional array to store the values in the matrices, and use for-loops to iterate through the values.


Can we add website link when we write java program?

yes ,i can add the website link in java program when we write.


Write a c program Fibonacci series using for loop in java?

Exactly what do you mean by 'C program in Java'


How do you write java program to times a number?

Java, like many other programming languages, uses the asterisk for the multiplication operator. Therefore, two numbers a and b are multiplied, and their product assigned to a variable r, with this construct: r = a * b;


What is javadoc?

write a java program to display "Welcome Java" and list its execution steps.


How write new line program in java?

\n


How do you write a java program for finding multiligual languages?

You can use Java's built-in functions to write a code that will find multilingual languages.


How java is 100 percent Internet based?

It isn't. It can also be used to write desktop applications. Java does have many options to program for the Internet, but that is not the only possibility.It isn't. It can also be used to write desktop applications. Java does have many options to program for the Internet, but that is not the only possibility.It isn't. It can also be used to write desktop applications. Java does have many options to program for the Internet, but that is not the only possibility.It isn't. It can also be used to write desktop applications. Java does have many options to program for the Internet, but that is not the only possibility.


Write a java code to draw a circle inside in an ellipse?

write a program draw circle and ellipse by using oval methods in java


How do you write a java program to find the ad joint of a matrix?

bgfygfrhjyuyhh


How do you write algorithms of java programs?

Write a program that graphically demonstrates the shortest path algorithm


How To write a java program to create three tier applications using servlets?

barsanabegam