Penjumlahan Mariks ordo 3×3

Bismillah.. 🙂

Tutorial Membuat program perkalian matriks dengan ordo 3×3 pada c++

1. Kode Program


#include <iostream>
using namespace std;

int main()
{
 int A[3][3];
 int B[3][3];
 int C[3][3];

int i,j;
 cout <<"================== Pemrograman C++ ==================" <<endl;
 cout <<" Penjumlahan Matriks Ordo 2x3 " <<endl;
 cout <<" Nama : Nurfiah " <<endl;
 cout <<" NIM : 49013085 " <<endl;
 cout <<"=====================================================" <<endl;
 //eleman Matriks A
 cout <<"Masukkan Elemen Matriks A" <<endl;
 for(i=0; i<3; i++){
 for(j=0; j<3; j++){
 cout <<"Indeks ke ["<<i<<"]["<<j<<"] : ";
 cin>>A[i][j];
 }
 }
 cout <<endl;
 //eleman Matriks B
 cout <<"Masukkan Elemen Matriks B" <<endl;
 for(i=0; i<3; i++){
 for(j=0; j<3; j++){
 cout <<"Indeks ke ["<<i<<"]["<<j<<"] : ";
 cin>>B[i][j];
 }
 }
 cout <<endl;
 //penjumlahan Matriks
 for(i=0; i<3; i++){
 for(j=0; j<3; j++){
 C[i][j] = A[i][j] + B[i][j];
 }
 }
 //menampilkan hasil penjumlahan Matriks A dengan Matriks B
 for(i=0; i<3; i++){
 for(j=0; j<3; j++){
 cout <<"C ["<<i<<"]["<<j<<"] : " <<C[i][j]<<endl;
 }
 }
 cout <<endl;
 system("pause");
 return 0;

}

output Program :

matrik

 

2. video Tutorial

 

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s