langsung saja kita ke input sbb;
#include <stdio.h>
#include <iostream>
#include <conio.h>
using namespace std;
main()
{ int i,j,hasil[4][2];
int data [4][2]={1,2,3,4,5,6,7,8},
data2 [4][2]={1,2,3,4,5,6,7,8};
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;
}
}
maka nanti akan muncul sbb ;
Tidak ada komentar:
Posting Komentar