Algoritma
deklarasi
A[maks][maks],baris,kolom::integer
deskripsi
read (baris,kolom)
for i <-- 1 to n -1 do
for j <-- 1 to n-1 do
baris,kolom := A[i][j]
for i <-- 1 to n-1 do
for j <-- 1 to n-1 do
for z <-- 1 to n-1 do
hasil := A[i][j]*2[m]
endfor
endfor
endfor
C++
#include <iostream>
#define maks 10
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int A[maks][maks], baris, kolom;
cout<<"input baris :"; cin>>baris;
cout<<"input kolom :"; cin>>kolom;
for(int i=0; i<baris; i++){
for(int j=0; j<kolom; j++){
cout<<"Masukan data ke ["<<i<<"] ["<<j<<"] : "; cin>>A[i][j];
}
}
cout<<"Isi Matriks A :\n";
for(int i=0; i<baris; i++){
for(int j=0; j<kolom; j++){
cout<<A[i][j]<<" ";
}
cout<<endl;
}
int m[baris],n;
cout<<"penghitungan vektor \n";
cout<<"berapa variabel : ";
cin>>m[kolom];
for(int z=0; z<kolom; z++){
cout<<"Masukan data ke ["<<z<<"] "" : "; cin>>m[z];
}
cout<<endl;
cout<<" vektor b : \n";
for(int z=0; z<kolom; z++){
cout<<m[z]<<"\n";
}
cout<<"perkalian matrik dan vektor \n";
for(int i=0; i<baris; i++){
for(int j=0; j<kolom; j++){
for(int z=0; z<kolom; z++){
n=A[i][j]*m[z];
cout<<n<<" ";
}
}
}
return 0;
}
deklarasi
A[maks][maks],baris,kolom::integer
deskripsi
read (baris,kolom)
for i <-- 1 to n -1 do
for j <-- 1 to n-1 do
baris,kolom := A[i][j]
for i <-- 1 to n-1 do
for j <-- 1 to n-1 do
for z <-- 1 to n-1 do
hasil := A[i][j]*2[m]
endfor
endfor
endfor
C++
#include <iostream>
#define maks 10
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int A[maks][maks], baris, kolom;
cout<<"input baris :"; cin>>baris;
cout<<"input kolom :"; cin>>kolom;
for(int i=0; i<baris; i++){
for(int j=0; j<kolom; j++){
cout<<"Masukan data ke ["<<i<<"] ["<<j<<"] : "; cin>>A[i][j];
}
}
cout<<"Isi Matriks A :\n";
for(int i=0; i<baris; i++){
for(int j=0; j<kolom; j++){
cout<<A[i][j]<<" ";
}
cout<<endl;
}
int m[baris],n;
cout<<"penghitungan vektor \n";
cout<<"berapa variabel : ";
cin>>m[kolom];
for(int z=0; z<kolom; z++){
cout<<"Masukan data ke ["<<z<<"] "" : "; cin>>m[z];
}
cout<<endl;
cout<<" vektor b : \n";
for(int z=0; z<kolom; z++){
cout<<m[z]<<"\n";
}
cout<<"perkalian matrik dan vektor \n";
for(int i=0; i<baris; i++){
for(int j=0; j<kolom; j++){
for(int z=0; z<kolom; z++){
n=A[i][j]*m[z];
cout<<n<<" ";
}
}
}
return 0;
}
Comments
Post a Comment