You are on page 1of 2

/*

* To change this license header, choose License Headers in Project Properties.


* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/*
* File: main.cpp
* Author: Laptop HP
*
* Created on September 9, 2017, 7:47 PM
*/

#include <iostream>

using namespace std;

/*
*
*/
int main(int argc, char** argv) {
int x[100][100],y[100][100],z[100][100];
int b,k;
cout<<"matriks x"<<endl;
cout<<"masukan baris ";cin>>b;
cout<<"masukan kolom ";cin>>k;
for (int i=1; i<=b; i++)
{
for (int j=1; j<=k; j++){
cout<<"masukan matriks x["<<i<<"]["<<j<<"] = ";
cin>>x[i][j];
}
}
cout<<endl;
for(int i=1; i<=b;i++)
{
for(int j=1;j<=k;j++){
cout<<x[i][j]<<" ";
}
cout<<endl;
}
cout<<endl;
cout<<"matriks y"<<endl;
cout<<"baris "<<b<<endl;
cout<<"kolom "<<k<<endl;
for (int i=1; i<=b; i++)
{
for (int j=1; j<=k; j++){
cout<<"masukan matriks y["<<i<<"]["<<j<<"] = ";
cin>>y[i][j];

}
}
cout<<endl;
for(int i=1; i<=b;i++)
{
for(int j=1;j<=k;j++){
cout<<y[i][j]<<" ";
}
cout<<endl;
}
cout<<endl;
for(int i=1; i<=b;i++)
{
for(int j=1;j<=k;j++){
z[i][j]=(x[i][j])+(y[i][j]);
}
}
cout<<"hasil tambah = "<<endl;
for(int i=1; i<=b;i++)
{
for(int j=1;j<=k;j++){
cout<<z[i][j]<<" ";
}
cout<<endl;
}
}

You might also like