//Enter matrix a & b..
//It wiill get Added,Subtracted,Multiplied as given condition gets satisfied..
//For all the condition to get satisfied enter matrix of order 3*3..
a=input("Enter matrix a:")
b=input("Enter matrix b:")
[m1 n1]=size(a)
[m2 n2]=size(b)
if size(a)==size(b) then
disp(a+b,"Addition of matrix:")
disp(a-b,"Subtraction of matrix:")
else
disp("Addition,Subtraction not possible:")
end
if n1==m2 then
disp(a*b,"Multiplication is:")
else
disp("Multiplication not possible:")
end
Output
-->exec('D:\Scilab prog by me\prac3.sce', -1)
Enter matrix a:[1 2 3;4 5 6]
Enter matrix b:[4 5 6;7 8 9;10 11 12]
Addition,Subtraction not possible:
Multiplication is:
48. 54. 60.
111. 126. 141.
-->exec('D:\Scilab prog by me\prac3.sce', -1)
Enter matrix a:[1 2 3;4 5 6]
Enter matrix b:[4 5 6;7 8 9]
Addition of matrix:
5. 7. 9.
11. 13. 15.
Subtraction of matrix:
- 3. - 3. - 3.
- 3. - 3. - 3.
Multiplication not possible:
-->exec('D:\Scilab prog by me\prac3.sce', -1)
Enter matrix a:[1 2 3;4 5 6;7 8 9]
Enter matrix b:[11 12 13;14 15 16;17 18 19]
Addition of matrix:
12. 14. 16.
18. 20. 22.
24. 26. 28.
Subtraction of matrix:
- 10. - 10. - 10.
- 10. - 10. - 10.
- 10. - 10. - 10.
Multiplication is:
90. 96. 102.
216. 231. 246.
342. 366. 390.
//It wiill get Added,Subtracted,Multiplied as given condition gets satisfied..
//For all the condition to get satisfied enter matrix of order 3*3..
a=input("Enter matrix a:")
b=input("Enter matrix b:")
[m1 n1]=size(a)
[m2 n2]=size(b)
if size(a)==size(b) then
disp(a+b,"Addition of matrix:")
disp(a-b,"Subtraction of matrix:")
else
disp("Addition,Subtraction not possible:")
end
if n1==m2 then
disp(a*b,"Multiplication is:")
else
disp("Multiplication not possible:")
end
Output
-->exec('D:\Scilab prog by me\prac3.sce', -1)
Enter matrix a:[1 2 3;4 5 6]
Enter matrix b:[4 5 6;7 8 9;10 11 12]
Addition,Subtraction not possible:
Multiplication is:
48. 54. 60.
111. 126. 141.
-->exec('D:\Scilab prog by me\prac3.sce', -1)
Enter matrix a:[1 2 3;4 5 6]
Enter matrix b:[4 5 6;7 8 9]
Addition of matrix:
5. 7. 9.
11. 13. 15.
Subtraction of matrix:
- 3. - 3. - 3.
- 3. - 3. - 3.
Multiplication not possible:
-->exec('D:\Scilab prog by me\prac3.sce', -1)
Enter matrix a:[1 2 3;4 5 6;7 8 9]
Enter matrix b:[11 12 13;14 15 16;17 18 19]
Addition of matrix:
12. 14. 16.
18. 20. 22.
24. 26. 28.
Subtraction of matrix:
- 10. - 10. - 10.
- 10. - 10. - 10.
- 10. - 10. - 10.
Multiplication is:
90. 96. 102.
216. 231. 246.
342. 366. 390.
No comments:
Post a Comment