Write a C function which accepts a positive integer, n, and returns 2^n. State any assumptions made.
So is this correct....??
#include<math.h>
double power(int x)
{
int i,pow,n, ans;
ans=1;
printf ("Enter the number and power:");
scanf ("%d%d", &pow, &n);
for(i=1;i<=pow; i++)
{
ans = ans *n
return pow(2,n);
}
int main ()
{
int x, y,c;
c=pow(x,y);
printf("%d to the power %d is %d",n,pow,ans);
getch();
}