The BOTTOM LINE Quote Of The Day

The BOTTOM LINE Quote Of The Day

Don't Ever Tell GOD How BIG Your Problems are.
Just Tell Your Problems How BIG your GOD is ;)

Monday, June 11, 2012

Finding Norm of Matrix


#include<conio.h>
#include<stdio.h>
#include<math.h>

int main()
  {
    int i,j,m,n;
    int mat[10][10];
    double s,nm;
    printf("\n Enter the no. of rows and columns : ");
    scanf("%d %d",&m,&n);
    s = 0;
    for(i=0;i<m;i++)
    {
      printf("Row %d : ",i+1);    
       
      for(j=0;j<n;j++)
      {
        scanf("%d",&mat[i][j]);    
        s += pow(mat[i][j],2);                  
      }              
    }
    nm = sqrt(s);
    printf("\n\nThe Norm of this matrix : %lf",nm);  
    getch();
    return 0;
  }

No comments:

Post a Comment