#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int n;
cout<<"Masukan Ordo Matriks : ";
cin>>n;
int a[n][n];
cout<<endl<<"Masukan Data dalam Matriks !"<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<"Kolom ("<<i<<","<<j<<") : ";
cin>>a[i][j];
}
}
cout<<endl<<"Matriks A !"<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<a[i][j];
cout<<" " ;
}
cout<<endl;
}
cout<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(a[i][i]=1){
cout<<"Matriks Diagonal !"<<endl;
}
else{
cout<<"Bukan Matriks Diagonal !"<<endl;
}
}
}
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int n;
cout<<"Masukan Ordo Matriks : ";
cin>>n;
int a[n][n];
cout<<endl<<"Masukan Data dalam Matriks !"<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<"Kolom ("<<i<<","<<j<<") : ";
cin>>a[i][j];
}
}
cout<<endl<<"Matriks A !"<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<a[i][j];
cout<<" " ;
}
cout<<endl;
}
cout<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(a[i][i]=1){
cout<<"Matriks Diagonal !"<<endl;
}
else{
cout<<"Bukan Matriks Diagonal !"<<endl;
}
}
}
system("PAUSE");
return EXIT_SUCCESS;
}
Posting Komentar