Math - Powers: My Code Solution

This is my solution to the powers challenge.

// Public Variables
public float root = 2f, exponent = 24;

// Start is called before the first frame update
void Start()
{
    var solution = System.Math.Pow(root, exponent);
    if (exponent == 2) { Debug.Log("The Value of " + root + " Squared is: " + solution); }
    else if(exponent == 3) { Debug.Log("The Value of " + root + "Cubed is: " + solution); }
    else { Debug.Log("The Value of " + root + " Raised to The " + exponent + "th Power is: " + solution); }
}

Coded for Unity in C#

1 Like

Looking good :slight_smile: