-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMatrisIslemler.c
107 lines (102 loc) · 2.16 KB
/
MatrisIslemler.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
102
103
104
105
106
107
#include<stdio.h>
#include<windows.h>
void topla();
void cikar();
void menu()
{
char secim;
printf(" Toplama Islemi icin'+'\n Cikarma Islemi icin'-'\n Cikis yapmak icin 'e' 'ye basiniz\n");
printf("Isleminiz :");
scanf("%s",&secim);
switch(secim)
{
case '+':
topla();
break;
case '-':
cikar();
break;
case 'e':
system("COLOR E");
system("PAUSE");
break;
default:
system("COLOR 3");
printf("Yanlis secim menudeki islemlerden seciniz :\n");
menu();
printf("\n");
}
}
int main()
{
menu();
return 0;
}
void topla()
{
system("COLOR D0");
printf("Birinci matrisi giriniz:\n");
int i,j;
int dizi[2][2];
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&dizi[i][j]);
}
}
printf("----------------------------------------------------------------------\n");
int dizi1[2][2];
printf("Ikinci matrisi giriniz :\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&dizi1[i][j]);
}
}
printf("----------------------------------------------------------------------\n");
printf("Toplamlarin sonucu \n");
int sonuc[i][j];
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
sonuc[i][j]=dizi[i][j]+dizi1[i][j];
printf("%d ", sonuc[i][j]);
}
printf("\n");
}
menu();
};
void cikar()
{
system("COLOR 1E");
int i,j;
int c[2][2],c1[2][2],sonuc1[2][2];
printf("Birinc matrisin degerini giriniz :");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
scanf("%d",&c[i][j]);
}
printf("----------------------------------------------------------------------\n");
printf("Ikinci matrisin degerini giriniz :");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
scanf("%d",&c1[i][j]);
}
printf("----------------------------------------------------------------------\n");
printf("Farklari : \n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
sonuc1[i][j]=c[i][j]-c1[i][j];
printf("%d ",sonuc1[i][j]);
}
printf("\n");
}
menu();
};