A general formula for the multi-period case
The price for the option in an $n$ period model is given by $$C=\frac{1}{(1+r)^n}\sum_{k=0}^n {n \choose k} q^k (1-q)^{n-k}y_{u^k d^{n-k}}.$$ Here ${n \choose k}$ denotes the number of ways in which one can choose $k$ objects from a selection of $n$ objects (called the binomial coefficient — you can read more in the Plus article Making the grade: Part II). Explicitly it is given by $${n \choose k} = \frac{n!}{k!(n-k)!},$$ where $$n! = n \times (n-1) \times (n-2) \times ... \times 2 \times 1.$$ The symbol $y_{u^k d^{n-k}}$ stands for $y$ with a subscript consisting of $k$ $u's$ and $n-k$ $d's$ - these stand for the payoffs corresponding to the various combinations of good and bad periods.\\ The expression $$\sum_{k=0}^n {n \choose k} q^k (1-q)^{n-k}y_{u^k d^{n-k}}$$ means that you should sum the terms of the form $${n \choose k} q^k (1-q)^{n-k}y_{u^k d^{n-k}}$$ in turn with $k$ substituted by 0, 1, 2, etc, up to $n$.