Pagini recente » Cod sursa (job #2886466) | Cod sursa (job #2729937) | Cod sursa (job #987750) | Istoria paginii runda/b/clasament | Cod sursa (job #3132451)
#include <stdio.h>
const int n_max = 10001;
const int m = 1999999973;
float exp_log(float x, int n)
{
if (n < 0)
{
x = 1.0 / x;
n = (-1) * n;
}
if (n == 0)
{
return 1;
}
float p = 1;
while (n > 0)
{
if (n % 2)
{
p = p * x;
}
x = x * x;
n = n / 2;
}
return p;
}
int main(void)
{
unsigned int n, p;
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%d %d", &n, &p);
printf("%g^%d = %g\n",n,p,exp_log(n,p));
return 0;
}