FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
DSA-PS-Java-Programs/MatrixMultiplication.java at master · codec-akash/DSA-PS-Java-Programs · GitHub
codec-akash
/
DSA-PS-Java-Programs
Public
Notifications
You must be signed in to change notification settings
Fork
32
Star
2
Code
Issues
1
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
DSA-PS-Java-Programs
/
MatrixMultiplication.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (55 loc) · 969 Bytes
Breadcrumbs
DSA-PS-Java-Programs
/
MatrixMultiplication.java
Copy path
File metadata and controls
58 lines (55 loc) · 969 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import
java
.
util
.
Scanner
;
//Other imports go here, Do NOT change the class name
class
MatrixMultiplication
{
public
static
void
main
(
String
[]
args
)
{
Scanner
sc
=
new
Scanner
(
System
.
in
);
int
x
=
sc
.
nextInt
();
while
(
x
>
0
)
{
int
r1
,
c1
,
r2
,
c2
,
i
,
j
;
r1
=
sc
.
nextInt
();
c1
=
sc
.
nextInt
();
int
arr
[][]=
new
int
[
r1
][
c1
];
for
(
i
=
0
;
i
<
r1
;
i
++)
{
for
(
j
=
0
;
j
<
c1
;
j
++)
{
arr
[
i
][
j
]=
sc
.
nextInt
();
}
}
r2
=
sc
.
nextInt
();
c2
=
sc
.
nextInt
();
int
b
[][]=
new
int
[
r2
][
c2
];
int
res
[][]=
new
int
[
r1
][
c2
];
for
(
i
=
0
;
i
<
r2
;
i
++)
{
for
(
j
=
0
;
j
<
c2
;
j
++)
{
b
[
i
][
j
]=
sc
.
nextInt
();
}
}
for
(
i
=
0
;
i
<
r1
;
i
++)
{
for
(
j
=
0
;
j
<
c2
;
j
++)
{
int
sum
=
0
;
for
(
int
k
=
0
;
k
<
r2
;
k
++)
{
sum
+=
arr
[
i
][
k
]*
b
[
k
][
j
];
}
res
[
i
][
j
]=
sum
;
}
}
for
(
int
r
=
0
;
r
<
r1
;
r
++)
{
for
(
int
y
=
0
;
y
<
c2
;
y
++)
System
.
out
.
print
(
res
[
r
][
y
]+
" "
);
System
.
out
.
println
();
}
x
--;
}
sc
.
close
();
}
}
Back
|
FazBrowse Home
|
New Git URL