-
Notifications
You must be signed in to change notification settings - Fork 1
/
Array sum,largest number and inverse.c.c
101 lines (82 loc) · 1.2 KB
/
Array sum,largest number and inverse.c.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include<stdio.h>
array();
inverse();
main(){
array();
inverse();
}
array(){
int arr[5][5];
int count;
int i ,j,max=0;
printf("enter elements of an array \n");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
scanf("%d",&arr[i][j]);
}
printf("\n");
}
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
if (arr[i][j] > max)
{
max=arr[i][j]; }
}
}
printf("The largest number is %d \n",max);
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
count=count+arr[i][j];
}
}
printf("the count is %d \n",count);
}
inverse(){
float pp[2][2];
int c[2][2]={};
int f,q;
printf("enter elements of an array \n");
for(f=0;f<2;f++)
{
for(q=0;q<2;q++)
{
scanf("%d",&c[f][q]);
}
printf("\n");
}
int k =c[0][0]*c[1][1];
int m =c[1][0]*c[0][1];
int l =k-m;
printf("the determenent is %d \n",l);
int o =c[0][0];
int s = c[1][1];
c[0][0]=s;
c[1][1]=o;
c[0][0]=c[1][1];
c[1][1]=s;
c[0][1]*-1;
c[1][0]*-1;
for(f=0;f<2;f++)
{
for(q=0;q<2;q++)
{
pp[f][q]=c[f][q]/l;
}
printf("\n");
}
printf("the inverse is \n");
for(f=0;f<2;f++)
{
for(q=0;q<2;q++)
{
printf("%f",pp[f][q]);
}
printf("\n");
}
}