Source Code :
#include<iostream>
#include<stdio.h>
#include<conio.h>
using namespace std;
int matriks[4][4];
int main()
{
cout<<"Matriks A "<<endl;
cout<<endl;
for(int i=1; i<5; i++)
{
for(int j=1; j<5; j++)
{
if (i<=j){
cout<<"Matriks A indeks ke "<<i<<","<<j<<": ";
cin>>matriks[i][j];
}else{
matriks[i][j]=0;
cout << "Matriks A indeks ke "<<i<<","<<j<<": " << matriks[i][j];
cout << endl;
}
}
}
cout<<endl;
cout<<"Tampilan matriks A : "<<endl;
for(int i=1; i<5; i++)
{
for(int j=1; j<5; j++)
{
cout<<matriks[i][j]<<" ";
}
cout<<endl;
}
cout<<endl;
getch ();
}
Output program :
Silahkan berkomentar yang sesuai dengan topik, Terima Kasih.
EmoticonEmoticon