Here are two ways to implement what’s given in the problem:
Take input as an array
[
a
1
,
a
2
,
a
3
]
[a_1,a_2,a_3]
[a1,a2,a3], and sort it. Output the middle element.
Write two if-statements. The first: if
(
a
>
b
(a>b
(a>b
a
n
d
and
and
a
<
c
)
aa<c)
o
r
or
or
(
a
<
b
(a(a<b
a
n
d
and
and
a
>
c
)
a>c)
a>c), output
a
a
a. Else, if
(
b
>
a
(b>a
(b>a
a
n
d
and
and
b
<
c
)
bb<c)
o
r
or
or
(
b
<
a
(b(b<a
a
n
d
and
and
b
>
c
)
b>c)
b>c), output
b
b
b. Else, output
c
c
c.