Pagini recente » Cod sursa (job #1461224) | tema | Cod sursa (job #3296573) | Cod sursa (job #2564959) | Cod sursa (job #2589647)
#include <stdio.h>
#include <stdlib.h>
float putere(float n,float exp,float counter,float aux)
{
if(exp==0)
return 1;
if(exp>0)
{
if(counter!=exp)
{
aux=aux*n;
return putere(n,exp,counter+1,aux);
}
}
else if(exp<0)
{
if(counter!=exp)
{
aux=aux*1.0/n;
return putere(n,exp,counter-1,aux);
}
}
return aux;
}
int main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
float n,exp;
scanf("%f %f",&n,&exp);
printf("%g",putere(n,exp,0,1));
return 0;
}