Jumat, 28 Juni 2013

0 Pogram Penambahan Matriks C++


Jangan Lupa Tinggalkan Komentar Kalian Ya...!!!
#include "iostream.h"

void main(){
  int a[3][3],b[3][3],c[3][3];
  int i,j;
  cout <<"Program Penambahan Matrik";
  cout <<"\n Input Matrik A:";
  for (i=0;i<=2;i++)
for (j=0;j<=2;j++){
cout <<"Nilai a["<<i<<","<<j<<"]:";cin>>a[i][j];
}

  cout <<"\n Input Matrik B:";
  for (i=0;i<=2;i++)
for (j=0;j<=2;j++){
cout <<"Nilai b["<<i<<","<<j<<"]:";cin>>b[i][j];
}

  for (i=0;i<=2;i++)
for (j=0;j<=2;j++)
c[i][j]=a[i][j]+b[i][j];
cout <<"Matrik C";
for (i=0;i<=2;i++)
for (j=0;j<=2;j++)
cout <<"C["<<i<<","<<j<<"]:"<<c[i][j];

}

Sumber : mesran.net

0 komentar:

Posting Komentar