Matrik
Program Matrik dengan Dev C++#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int i,j,hasil[2][2];
int A[2][2]={6,5,4,3},B[2][2]={6,5,4,3};
cout<<"Isi variabel data adalah "<<endl;
cout<<"--------------------------\n\n";
cout<<" MATRIK 1 | MATRIK 2 "<<endl<<endl;
for(i=0;i<2;i++){
for(j=0;j<2;j++)
cout<<" "<<A[i][j]<<" ";}
cout<<" ";
for(i=0;i<2;i++){
for(j=0;j<2;j++)
cout<<" "<<B[i][j]<<" ";}
cout<<endl<<endl;
cout<<"HASIL : ";
for(i=0;i<2;i++){
for(j=0;j<2;j++){
hasil[i][j]=A[i][j]+B[i][j];
cout<<" "<<hasil[i][j]<<" ";
}
}
return 0;
}
Langganan:
Posting Komentar
(
Atom
)
Tidak ada komentar :
Posting Komentar