Home Forums C Programming Help with this C coding Re: Re: Help with this C coding

#3485
Adetutu
Participant

I hope this is program of you assignment. :lol: Any way If you want to calculate 2 to power n(2^n) Please try this piece of code.

/***********************************************
Program to Calculate 2 to power n (2^n)
***********************************************/
#include
int main()
{
int n, i , pow = 1;

printf(“Enter the number (n):: “);
scanf(“%d” , &n);
for(i = 0; i < n; i++)
{
pow = pow * 2;
}
printf(“Result is :: %d”, pow);
}

Please feel to revert back.
Thanks
Gaurav