-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoperation.c
70 lines (64 loc) · 932 Bytes
/
operation.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
#include <math.h>
#include <stdio.h>
void p4_1_a()
{
double y;
int x;
scanf("%d", &x);
y = (x > 0 && x < 2) ? (cos(x) * cos(x)) : (1 - sin(x*x));
printf("%.5lf\n", y);
}
void p4_1_v()
{
int a, b, x, y;
scanf("%d %d", &a, &b);
a > b ? (x = a, y = b): (x = b, y = a);
printf("%d %d\n", x, y);
}
void p4_1_d()
{
int x, y, z;
scanf("%d %d", &x, &y);
z = x < 0 ? (x > y ? x: y) : (x < y ? x: y);
printf("%d\n", z);
}
void p4_5()
{
int w;
scanf("%d", &w);
if (1 / tan(w) < 0.5)
printf("%d\n", -w);
else
if (w == 0)
printf("%d\n", w = 1);
}
int p4_9()
{
int a, b, c, x;
a = b = 1;
c = 0;
x = a ? b : c;
return x;
}
void p4_20()
{
int i, a, b;
b = 1;
scanf("%d", &a);
for (i = 1; a == 0; i++)
{
scanf("%d", &a);
b *= a;
}
printf("%.5lf\n", (double)(b / i));
}
int main()
{
p4_1_a();
p4_1_v();
p4_1_d();
p4_5();
p4_9();
p4_20();
return 0;
}