-
Notifications
You must be signed in to change notification settings - Fork 1
/
norm.c
55 lines (45 loc) · 975 Bytes
/
norm.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<stdio.h>
#include<math.h>
main()
{ int i,j,n,m,a[10][10],sum=0;
double norm;
printf("\nEnter the dimensions:: ");
scanf("%d%d",&n,&m);
printf("\nEnter the eleents of matrix::\n");
for(i=0;i<n;i++)
for(j=0;j<m;j++)
scanf("%d",&a[i][j]);
printf("\nOriginal Matrix is:: ");
for(i=0;i<n;i++)
{ printf("\n");
for(j=0;j<n;j++)
printf("\t%d",a[i][j]);
}
for(i=0;i<n;i++)
for(j=0;j<m;j++)
{ sum+=(a[i][j] * a[i][j]);
}
norm=sqrt((double)sum);
printf("\nNORM:: %lf", norm);
}
{ int i,j,n,m,a[10][10],sum=0;
double norm;
printf("\nEnter the dimensions:: ");
scanf("%d%d",&n,&m);
printf("\nEnter the eleents of matrix::\n");
for(i=0;i<n;i++)
for(j=0;j<m;j++)
scanf("%d",&a[i][j]);
printf("\nOriginal Matrix is:: ");
for(i=0;i<n;i++)
{ printf("\n");
for(j=0;j<n;j++)
printf("\t%d",a[i][j]);
}
for(i=0;i<n;i++)
for(j=0;j<m;j++)
{ sum+=(a[i][j] * a[i][j]);
}
norm=sqrt((double)sum);
printf("\nNORM:: %lf", norm);
}