Step 1: Write probabilities using binomial distribution.
For
\[
X\sim B(n,p),
\]
the probability mass function is
\[
P(X=r)={}^{n}C_r p^r(1-p)^{n-r}
\]
Given,
\[
P(X=2)=P(X=3)
\]
Therefore,
\[
{}^{n}C_2 p^2(1-p)^{n-2}
=
{}^{n}C_3 p^3(1-p)^{n-3}
\]
Step 2: Simplify the equation.
Dividing both sides by
\[
p^2(1-p)^{n-3},
\]
we get
\[
{}^{n}C_2(1-p)
=
{}^{n}C_3 p
\]
Using
\[
{}^{n}C_2=\frac{n(n-1)}{2}
\]
and
\[
{}^{n}C_3=\frac{n(n-1)(n-2)}{6},
\]
we get
\[
\frac{n(n-1)}{2}(1-p)
=
\frac{n(n-1)(n-2)}{6}p
\]
Cancelling \(n(n-1)\),
\[
\frac{1-p}{2}
=
\frac{(n-2)p}{6}
\]
Multiplying by \(6\),
\[
3(1-p)=(n-2)p
\]
\[
3-3p=np-2p
\]
\[
3-p=np
\]
Step 3: Find the mean.
Mean of a binomial distribution is
\[
np
\]
From above,
\[
np=3-p
\]
Hence, mean of \(X\) is
\[
\boxed{3-p}
\]
Step 4: Final conclusion.
Therefore,
\[
\boxed{3-p}
\]