Sabtu, 14 Mei 2011

PROGRAM C++ MATRIKS 3x2

#include<iostream.h>
#include<conio.h>
void main()
{
int M1[3][2],M2[2][3],hasil[3][2];
int i,j;
clrscr();
cout<<"MATRIKS 1";
for(i=1;i<=3;i++)
{
for(j=1;j<=2;j++)
{
cout<<"elemen["<<i<<"]["<<j<<"]:";
cin>>M1[i][j];
}
}
cout<<"MATRIKS 2";
for(i=1;i<=3;i++)
{
for(j=1;j<=2;j++)
{
cout<<"elemen["<<i<<"]["<<j<<"]:";
cin>>M2[i][j];
}
}
cout<<"HASIL PERHITUNGAN";
for(i=1;i<=3;i++)
for(j=1;j<=2;j++)
{
hasil[i][j]=M1[i][j]+M2[i][j]
cout<<"HASIL PERHITUNGAN: "<<hasil[i][j];
}
cout<<endl;
}
getch();
}

Tidak ada komentar:

Posting Komentar