aboutsummaryrefslogtreecommitdiff
path: root/src/libc/math.c
blob: 2051dc153116864cf1be7d61b7e04eb7b4edcfca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "math.h"

int pow(int x,int n){
    if(n<0)
        return -1;
    else if(n==0)
        return 1;
    else if(n==1)
        return x;
    int ret=x;
    for(int i=0;i<(n-1);i++)
        ret*=x;
    return ret;
}