Want to take input from User!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Want to take input from User!!!

What changes do i need here in Matrix Multiplication Java I want to take user input in 3 dimensional matrix and show in Matrix C https://code.sololearn.com/c826kdzUXO29/?ref=app

18th Jul 2021, 6:35 AM
MD Ashik Karim Nayon
MD Ashik Karim Nayon - avatar
4 Answers
+ 1
Hope this helps you
18th Jul 2021, 7:13 AM
Atul [Inactive]
+ 1
import java.util.*; public class matrixmultiplication { public static void main(String[] args){ Scanner sc=new Scanner (System.in); int [] [] a=new int [3] [3]; int [] [] b=new int [3] [3]; int [] [] c=new int [3] [3]; for(int i=0;i<a;i++) { for(int j=0;j<b;j++) { for(int k=0;k<c;k++) { arr[i][j][k]=sc.nextInt(); } } } for(int i=0;i<=2;i++) for(int j=0;j<=2;j++) { a[i][j]=10+i+j; b[i][j]=20+i+j; } System.out.println("Matrix A:"); for(int i=0;i<=2;i++) { for(int j=0;j<=2;j++) System.out.print("\t"+a[i][j]); System.out.println("\t"); } System.out.println("\n"); System.out.println ("Matrix B:"); for(int i=0;i<=2;i++) { for(int j=0;j<=2;j++) System.out.print("\t"+b[i][j]); System.out.println("\
18th Jul 2021, 7:12 AM
Atul [Inactive]
+ 1
Thanx man 😍
26th Jul 2021, 6:07 AM
MD Ashik Karim Nayon
MD Ashik Karim Nayon - avatar
26th Jul 2021, 6:48 AM
Atul [Inactive]