Calculate probability of getting half as many heads as coin tosses. Write a program that, given a small positive even integer from standard input, calculates the probability that flipping that many coins will result in half as many heads.

For example, given 2 coins the possible outcomes are:

HH HT TH TT


where H and T are heads and tails. There are 2 outcomes (HT and TH) that are half as many heads as the number of coins. There are a total of 4 outcomes, so the probability is 2/4 = 0.5.

This is simpler than it looks.

Test cases:

2 -&gt; 0.5
4 -&gt; 0.375
6 -&gt; 0.3125
8 -&gt; 0.2734375
Pari/GP - 32 30 34 chars

print(binomial(n=input(),n\2)/2^n)