# Find the Trace & Normal of a given Matrix with C

#include <stdio.h> #include <math.h> void main () { static int array[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", &array[i][j]); a = array[i][j] * array[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 + array[i][i]; } printf("Trace of the matrix is = %d\n", sum); }

### Share this:

- Click to share on Twitter (Opens in new window)
- Click to share on Facebook (Opens in new window)
- Click to share on Google+ (Opens in new window)
- Click to share on WhatsApp (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Click to share on Skype (Opens in new window)
- Click to email this to a friend (Opens in new window)
- Click to share on Pinterest (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to print (Opens in new window)