Solution (source code)

= Solution

For positive spot, strike, volatility and maturity, the <Black-Scholes formula> is
$$
\boxed{C=S_0\Phi(d_1)-Ke^{-rT}\Phi(d_2),\qquad
P=Ke^{-rT}\Phi(-d_2)-S_0\Phi(-d_1)},
$$
where $d_1=[\log(S_0/K)+(r+\sigma^2/2)T]/(\sigma\sqrt T)$ and $d_2=d_1-\sigma\sqrt T$. Degenerate zero-volatility or zero-maturity cases are obtained by limits.