Assingment 1 - 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Your options are:

-----------------
1) Add 2 matrices
2) Subtract 2 matrices
3) Multiply 2 matrices
4) Multiply matrix by a constant
5) Transpose matrix
6) Matrix trace
0) EXIT
Please enter your option:1
Enter the size of square matrices:4
First matrix is:
9 1 8 4
7 8 4 2
4 10 3 5
5 7 8 10
Second matrix is:
9 6 1 6
3 4 7 9
6 5 6 7
6 5 4 5
The resulting matrix is:
18 7 9 10
10 12 11 11
10 15 9 12
11 12 12 15
Command number 1 completed.
Your options are:
-----------------
1) Add 2 matrices
2) Subtract 2 matrices
3) Multiply 2 matrices
4) Multiply matrix by a constant
5) Transpose matrix
6) Matrix trace
0) EXIT
Please enter your option:2
Enter the size of square matrices:3
First matrix is:
5 9 10
10 4 7
7 3 4
Second matrix is:
5 2 5
5 2 8
9 5 7
The resulting matrix is:
0 7 5
5 2 -1
-2 -2 -3
Command number 2 completed.
Your options are:
-----------------
1) Add 2 matrices
2) Subtract 2 matrices
3) Multiply 2 matrices
4) Multiply matrix by a constant
5) Transpose matrix
6) Matrix trace
0) EXIT
Please enter your option:3
Enter the size of square matrices:5
First matrix is:
10 3 8 2 3
5 6 2 4 9
2 5 1 4 4
4 6 10 9 3
4 5 3 5 4
Second matrix is:
5 8 6 7 3
9 8 1 1 7
4 10 2 5 10
7 6 10 5 8
5 5 4 5 2
The resulting matrix is:
138 211 111 138 153
160 177 116 116 127
107 110 75 64 91
192 249 152 144 232
132 152 101 93 125
Command number 3 completed.
Your options are:
-----------------
1) Add 2 matrices
2) Subtract 2 matrices
3) Multiply 2 matrices
4) Multiply matrix by a constant
5) Transpose matrix
6) Matrix trace
0) EXIT
Please enter your option:4
Enter the size of square matrices:3
Enter the multiplication constant:4
The matrix is:
10 1 4
3 6 1
6 3 8
The original matrix multiplied by 4 is:
40 4 16
12 24 4
24 12 32
Command number 4 completed.
Your options are:
-----------------
1) Add 2 matrices
2) Subtract 2 matrices
3) Multiply 2 matrices
4) Multiply matrix by a constant
5) Transpose matrix
6) Matrix trace
0) EXIT
Please enter your option:5
Enter the size of square matrices:5
The matrix is:
9 2 6 4 10
1 5 5 2 5
10 8 9 10 6
1 1 1 3 4
1 7 1 5 2
The transposed matrix is:
9 1 10 1 1
2 5 8 1 7
6 5 9 1 1
4 2 10 3 5
10 5 6 4 2
Command number 5 completed.
Your options are:
-----------------
1) Add 2 matrices
2) Subtract 2 matrices
3) Multiply 2 matrices
4) Multiply matrix by a constant
5) Transpose matrix
6) Matrix trace
0) EXIT
Please enter your option:6
Enter the size of square matrices:3
The matrix is:
2 8 1
4 6 8
8 3 3
The trace for this matrix is: 11
Command number 6 completed.
Your options are:
-----------------
1) Add 2 matrices
2) Subtract 2 matrices
3) Multiply 2 matrices
4) Multiply matrix by a constant
5) Transpose matrix
6) Matrix trace
0) EXIT
Please enter your option:0

You might also like