Cod sursa(job #2589640)
| Utilizator | Data | 26 martie 2020 17:36:43 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
| Compilator | c-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.34 kb |
#include <stdio.h>
#include <stdlib.h>
int putere(int n,int exp)
{
if(exp==0)
return 1;
else
return n *putere(n,exp-1);
}
int main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
int n,exp;
scanf("%d %d",&n,&exp);
printf("%d",putere(n,exp));
return 0;
}
