Senin, 14 Januari 2013

Penjumlahan Matriks Ordo 3x4 pada C++

ini dia source code nya :
silahkan di coba dan semoga bermanfaat !!!

#include "iostream.h"
void main(){
int B[3][4],C[3][4],A[3][4];
int i, j;
cout<<"Input Matrik A\n";
for(i=0; i<3; i++)
for(j=0; j<4; j++){

cout<<"Matrik A["<<i<<","<<j<<"] : ";
cin>>A[i][j];
}
cout<<"\n Input Matrik B\n";
for(i=0; i<3; i++)
for(j=0; j<4; j++){
cout<<"Matrik B["<<i<<","<<j<<"] : ";
cin>>B[i][j];
}
for(i=0; i<3; i++)
for(j=0; j<4; j++)
C[i][j]=A[i][j]+B[i][j];
cout<<"\nMatrik C \n";
for(i=0; i<3; i++){
for(j=0; j<4; j++){
cout<< C[i][j]<<" ";
}
cout<<"\n";
}
}

1 komentar:
Write komentar