#include<iostream>
#include<stdio.h>
#include<conio.h>
using namespace std;
int main()
{
int a[20][20],b[20][20],c[20][20],i,j,k,m,n,f;
cout << "Input row and column of A matrix \n\n";
cin >> n >> m;
cout << "\n\nInput A - matrix \n\n";
for(i=0;i<n;++i)
for(j=0;j<m;++j)
cin >> a[i][j];
cout << "\n\nMatrix A : \n\n";
for(i=0;i<n;++i)
{
for(j=0;j<m;++j)
cout << a[i][j] << " ";
cout << "\n\n";
}
for(i=0;i<m;++i)
for(j=0;j<n;++j)
b[i][j]=a[j][i];
cout << "\n\nTranspose of matrix A is : \n\n";
for(i=0;i<m;++i)
{
for(j=0;j<n;++j)
cout << b[i][j] << " ";
cout << "\n\n";
}
for(i=0;i<m;i++)
{
for(j=0;j<m;j++){
c[i][j]=0;
for(k=0;k<=m;k++)
c[i][j]+=a[i][k]*b[k][j];
}
}
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
if((int)c[i][i]==1&&(int)c[i][j]==0)
f=1;
}
}
cout<<"\n\n Matrix A * transpose of A \n\n";
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
cout << c[i][j];
cout << "\n\n";
}
if(f==1)
cout << "\n\nMatrix A is Orthogonal !!!";
else
cout << "\n\nMatrix A is NOT Orthogonal !!!";
getch();
return 0;
}
-ALOK
Here is the C program to check whether the inputted matrix is scalar matrix or not. ( its not my creation, its get from other website,am not check) #include<stdio.h> #include<conio.h> int main() { int a[10][10],i,j,m,n,f=0; printf("Enter the order of the matrix\n"); scanf("%d%d",&m,&n); printf("Enter the matrix\n"); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); } } if(m!=n) { printf("The matrix is not identity"); } else { for(i=0;i<m;i++) { for(j=0;j<n;j++) { if((i==j&&a[i][j]!=a[0][0])(i!=j&&a[i][j]!=0)) { printf("The matrix is not scalar\n"); f=1; break; } } if(f==1) { break; } } if(f==0) { printf("The matrix is scalar\n"); } } getch(); return 0; }
means whether the matrix is same or not program for symmetric matrix : include<stdio.h> #include<conio.h> main() { int a[10][10],at[10][10],k,i,j,m,n; clrscr(); printf("enter the order of matrix"); scanf("%d %d",&m,&n); printf("enter the matrix"); for(i=0;i<m;i++) { for(j=0;j<n;j++) scanf("%d",&a[i][j]); } for(i=0;i<m;i++) { for(j=0;j<n;j++) at[i][j]=a[j][i]; } for(i=0;i<m;i++) { for(j=0;j<n;j++) { if(at[i][j]!=a[i][j]) k=1; } } if(k==1) printf("not symmetric"); else printf("symmetric"); getch(); }
Active Time spent online
To determine if an array is symmetric, the array must be square. If so, check each element against its transpose. If all elements are equal, the array is symmetric.For a two-dimensional array (a matrix) of order n, the following code will determine if it is symmetric or not:templatebool symmetric(const std::array& matrix){for (size_t r=0 ; r
Check related links
the transpose of null space of A is equal to orthogonal complement of A
write a c++program by using if statement to read a number and check whether it is positive or negative
Going through a program on paper to check whether it has errors.
Here is the C program to check whether the inputted matrix is scalar matrix or not. ( its not my creation, its get from other website,am not check) #include<stdio.h> #include<conio.h> int main() { int a[10][10],i,j,m,n,f=0; printf("Enter the order of the matrix\n"); scanf("%d%d",&m,&n); printf("Enter the matrix\n"); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); } } if(m!=n) { printf("The matrix is not identity"); } else { for(i=0;i<m;i++) { for(j=0;j<n;j++) { if((i==j&&a[i][j]!=a[0][0])(i!=j&&a[i][j]!=0)) { printf("The matrix is not scalar\n"); f=1; break; } } if(f==1) { break; } } if(f==0) { printf("The matrix is scalar\n"); } } getch(); return 0; }
means whether the matrix is same or not program for symmetric matrix : include<stdio.h> #include<conio.h> main() { int a[10][10],at[10][10],k,i,j,m,n; clrscr(); printf("enter the order of matrix"); scanf("%d %d",&m,&n); printf("enter the matrix"); for(i=0;i<m;i++) { for(j=0;j<n;j++) scanf("%d",&a[i][j]); } for(i=0;i<m;i++) { for(j=0;j<n;j++) at[i][j]=a[j][i]; } for(i=0;i<m;i++) { for(j=0;j<n;j++) { if(at[i][j]!=a[i][j]) k=1; } } if(k==1) printf("not symmetric"); else printf("symmetric"); getch(); }
write a programe to build a sparse matrix as an array. write function to check if the sparse matrix is a square, diagonal,lower triangular, upper triangular or tridiagonal matrix
Use the Exception class and type converters.
write a program in C to check whether a given number is apalindrome or not
Active Time spent online
8086 assembly language program to check wether given number is perfect or not
To determine if an array is symmetric, the array must be square. If so, check each element against its transpose. If all elements are equal, the array is symmetric.For a two-dimensional array (a matrix) of order n, the following code will determine if it is symmetric or not:templatebool symmetric(const std::array& matrix){for (size_t r=0 ; r
Check related links