Code for Program to print values of 2 raise to power N, N and 2 raise to power -n in C Programming
#include<stdio.h>
#include<conio.h>
void main()
{
longint p;
int n;
double q;
printf("-------------------------------------------\n");
printf(" 2 to power n n 2 to power -n\n");
printf("-------------------------------------------\n");
p=1;
for(n=0;n<21;n++)
{
if(n==0)
{
p=1;
}
else
{
p=p*2;
}
q=1.0/(double)p;
printf("%10ld %10d %20.12lf\n",p,n,q);
}
printf("-------------------------------------------\n");
getch();
}