Gambar di atas sebagi contoh output dari program sederhana di bawah ini....
Good luck !!!!
^_^
#include "iostream.h"
void main(){
int A[2][3];
int B[2][3];
int C[2][3];
int i,j;
for (i=0;i<2;i++){
for (j=0;j<3;j++){
cout<<"Matrik A["<<i<<","<<j<<"] : ";
cin>>A[i][j];
}
}
cout<<endl;
for (i=0;i<2;i++){
for (j=0;j<3;j++){
cout<<"Matrik B["<<i<<","<<j<<"] : ";
cin>>B[i][j];
}
}
cout<<endl;
for (i=0;i<2;i++)
for (j=0;j<3;j++)
C[i][j]=A[i][j]+ B[i][j];
cout<<"Hasil C : " <<endl;
for (i=0;i<2;i++){
for (j=0;j<3;j++){
cout<<C[i][j]<<" ";
}
cout<<endl;
}
}
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar