#include <stdio.h>
#include <iostream>
#include <conio.h>
using namespace std;
main()
{ int i,j,hasil[4][2];
int data [4][2]={5,6,3,7,8,1,9,2},
data2 [4][2]={6,3,2,7,8,1,5,9};
cout<<"Isi variabel data adalah "<<endl;
cout<<"-------------------------\n\n";
cout<<"\tMatrik 1\t\t\t|\tMatrik 2"<<endl;
for (i=0;i<4;i++)
{ for(j=0;j<2;j++)
{ cout<<"\t"<<data[i][j]<<"\t";}
cout<<"\t|\t";
for(j=0;j<2;j++)
{cout<<data2[i][j]<<"\t\t";}
cout<<endl;
}
cout<<"\n\n Hasil Penjumlahan kedua Matrik"<<endl;
for (i=0;i<4;i++)
{for (j=0;j<2;j++)
{hasil[i][j]=data[i][j]+data2 [i][j];
cout<<" "<<hasil [i][j]<<" ";
}
cout<<endl;
}
}
Sabtu, 12 Maret 2016
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar