Heads Tails Probability

The probability of n heads in a row tossing a fair coin is 2n. Calculate the probability for any positive integer n ( 0

Input 

A list of valid values of n (one per line).

Output 

Print a table of n and 2n in the following for the given values of n, using the following format: 

2^-n = z.xxxe-y

where z is a nonzero decimal digit, each x is a decimal digit and each y is a decimal integer with no leading zeros or spaces.

Sample Input 

1 
100
10000
1000000

Sample Output 

2^-1 = 5.000e-1 
2^-100 = 7.889e-31
2^-10000 = 5.012e-3011
2^-1000000 = 1.010e-301030

C Code

#include<stdio.h>
#include<math.h>

void main() {
   double digit, n, y;
   while(scanf("%lf",&n) == 1) {
      digit = floor(log10(2)*n+1);
      printf("2^-%.0lf = %.3lfe-%.0lf\n",n,pow(2,(digit/log10(2) - n)),digit);
   }
}