#include <stdio.h>
#include <math.h>
void main ()
{
static int ma[10][10];
int i,j,m,n,sum=0,sum1=0,a=0,normal;
printf (“Enter the order of the matrix\n”);
scanf (“%d %d”, &m,&n);
printf (“Enter the n coefficients of the matrix \n”);
for (i=0;i<m;++i)
{
for (j=0;j<n;++j)
{
scanf (“%d”,&ma[i][j]);
a = ma[i][j]*ma[i][j];
sum1 = sum1+a;
}
}
normal = sqrt(sum1);
printf (“The normal of the given matrix is = %d\n”,normal);
for (i=0;i<m;++i)
{
sum = sum + ma[i][i];
}
printf (“Trace of the matrix is = %d\n”,sum);
} /*End of main() */
/*—————————————————
Output
Enter the order of the matrix
3 3
Enter the n coefficients of the matrix
1 2 3
4 5 6
7 8 9
The normal of the given matrix is = 16
Trace of the matrix is = 15
Run 2
Enter the order of the matrix
2 2
Enter the n coefficients of the matrix
2 4
6 8
The normal of the given matrix is = 10
Trace of the matrix is = 10
—————————————————–*/
Not Satisfied ? Just search & get the result
Related posts:
- C program to find accept a matrix of order M x N and find the sum of the main diagonal and off diagonal elements
- C program to accept a matrix of order M x N and store its elements and interchange the main diagonal elements of the matrix with that of the secondary diagonal elements
- C program to read two matrices A (MxN) and B(MxN) and perform addition OR subtraction of A and B. Find the trace of the resultant matrix. Output the given matrix, their sum or Differences and the trace.
- C program to read a matrix A (MxN) and to find the following using functions a) Sum of the elements of each row b) Sum of the elements of each column c) Find the sum of all the elements of the matrix Output the computed results with suitable headings
- C program to accept a matrix of order M x N and find the sum of each row and each column of a matrix

{ 1 trackback }