Professional Documents
Culture Documents
LAB-7
Task1:
Source Code:
#include <iostream>
using namespace std;
int main()
{
int A[2][2], B[2][2], C[2][2];
cout << "Enter Elements of Matrix A" << endl;
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++)
{
cin >> A[i][j];
}
cout << "Enter Elements of Matrix B" << endl;
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++)
{
cin >> B[i][j];
}
cout << "Sum of two matrices is :"<< endl;
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++)
{
C[i][j] = A[i][j] + B[i][j];
cout << C[i][j] << endl;
return 0;
}
Snapshot:
Name: Talha Amin
Enrollment no: 02-235191-015 Lab 7 Date: 3/27/2019
Task3:
Source Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int A[4][3], B[4][3] ;
cout << "Enter Elements of Matrix A" << endl;
for (int i = 0; i < 4; i++)
for (int j = 0; j < 3; j++)
{
cin >> A[i][j];
}
Snapshot: