Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- University : HTI
- CodeName : Write a program to get summation of two matrix
- SubjectName : Programming Structure
- SubjectCode : csc121
- Group : https://www.facebook.com/groups/1421186571334814
- event : Ready to final
- */
- #include "stdafx.h"
- #include "iostream"
- using namespace std;
- int main(void)
- {
- float x[2][2], y[2][2];
- // Insert [x] Matrix
- for(int i = 0; i < 2; i++)
- {
- for(int n = 0; n < 2; n++)
- {
- cout << "X[" << (i+1) << "][" << (n+1) << "]= ";
- cin >> x[i][n];
- }
- }
- // Insert [y] Matrix
- for(int i = 0; i < 2; i++)
- {
- for(int n = 0; n < 2; n++)
- {
- cout << "Y[" << (i+1) << "][" << (n+1) << "]= ";
- cin >> y[i][n];
- }
- }
- // print matrix
- for(int i = 0; i < 2; i++)
- {
- for(int n = 0; n < 2; n++)
- {
- cout << " " << x[i][n] + y[i][n] << " ";
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement