-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasitHesapMakinesi.c
62 lines (51 loc) · 975 Bytes
/
basitHesapMakinesi.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
#include <stdio.h>
int topla(int *n1, int *n2);
int cikar(int *n1, int *n2);
int carp(int *n1, int *n2);
float bol(int *n1, int *n2);
int main()
{
int num1, num2;
int islem;
int *p1, *p2;
printf("1. sayi:\n");
scanf("%d",&num1);
printf("2. sayi:\n");
scanf("%d",&num2);
printf("islemi giriniz: 1)+\t2)-\t3)*\t4)/\n");
scanf("%d",&islem);
p1 = &num1;
p2 = &num2;
switch(islem)
{
case 1:
printf("%d",topla(p1, p2));
break;
case 2:
printf("%d",cikar(p1, p2));
break;
case 3:
printf("%d",carp(p1, p2));
break;
case 4:
printf("%f",bol(p1, p2));
break;
}
return 0;
}
int topla(int *n1, int *n2)
{
return *n1 + *n2;
}
int cikar(int *n1, int *n2)
{
return *n1 - *n2;
}
int carp(int *n1, int *n2)
{
return *n1 * *n2;
}
float bol(int *n1, int *n2)
{
return *n1 / *n2;
}