The probability of getting \(k\) heads when flipping \(n\) coins is

\(P(E) = {n \choose k} p^k (1-p)^{n-k}\)