-
Notifications
You must be signed in to change notification settings - Fork 0
/
Matris İşlemleri.c
64 lines (48 loc) · 1.04 KB
/
Matris İşlemleri.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
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
// MATRÝS //
int main(int argc, char *argv[]) {
int matris[2][2];
int i,j;
int toplam=0;
char islem;
printf("2x2'lik bir matris olusturunuz:");
for(i=0;i<2;i++) {
for(j=0;j<2;j++) {
scanf("%d",&matris[i][j]);
}
}
for(i=0;i<2;i++) {
for(j=0;j<2;j++) {
printf("%d ",matris[i][j]);
}
printf("\n");
}
printf("matrisiniz uzerinde yapacaginiz islemi seciniz:\n");
printf("satir toplamini bulmak icin 1'e basiniz\nsutun toplamini bulmak icin 2'ye basiniz:\n");
scanf("%d",&islem);
switch(islem) {
case 1: {
for(i=0;i<2;i++) {
for(j=0;j<2;j++) {
toplam=toplam+matris[i][j];
}
printf("%d ",toplam);
toplam=0;
}
break;
}
case 2: {
for(j=0;j<2;j++) {
for(i=0;i<2;i++) {
toplam=toplam+matris[i][j];
}
printf("%d ",toplam);
toplam=0;
}
break;
}
}
return 0;
}