2 to 24 Powers Challange

Hİ.
I did not just want to use Math.Pow(2,24). So I found this;

int x = 1;
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log(Power(2, 24));
    }

    int Power(int a, int b)
    {
        for (int i = 0; i < b; i++)
        {
            x = a * x;
        }
        return x;
    }

Yeah, I am sad I forgot most things… Could not come up with the solution all by myself =(

1 Like

Just keep it up and you’ll be a master in no time

1 Like