-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.c
More file actions
72 lines (72 loc) · 1.17 KB
/
Copy pathfunction.c
File metadata and controls
72 lines (72 loc) · 1.17 KB
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
#include <stdio.h>
int sum(int a, int b);
int mul(int c, int d);
float div(float e, float f);
int sub(int g, int h);
int mod(int i, int j);
int main()
{
int x, y, z;
printf("Enter two numbers: ");
scanf("%d %d", &x, &y);
int summ = sum(x, y);
int multi = mul(x, y);
float divi = div(x, y);
int subs = sub(x, y);
int modu = mod(x, y);
printf("\nsummation= %d\n", summ);
printf("multiply= %d\n", multi);
printf("division= %.3f\n", divi);
printf("substraction= %d\n", subs);
printf("modulus= %d\n", modu);
return 0;
}
int sum(int a, int b)
{
int su = a + b;
return su;
}
int mul(int c, int d)
{
int mu = c * d;
return mu;
}
float div(float e, float f)
{
float di;
if (e >= f)
{
di = e / f;
}
else
{
di = f / e;
}
return di;
}
int sub(int g, int h)
{
int s;
if (g >= h)
{
s = g - h;
}
else
{
s = h - g;
}
return s;
}
int mod(int i, int j)
{
int mo;
if (i >= j)
{
mo = i % j;
}
else
{
mo = j % i;
}
return mo;
}