[Solved] allExponent write your code here for negative exponentInput

allExponent: You are given a base value and an exponent value. You need to calculate the value of the base raised to the power of the exponent. You need to implement the allExponent method which takes the base value and the exponent value as input and returns the value of the base raised to the power of the exponent.

class Solution
{
    float allExponent(int baseValue, int exponentValue)
    {
        float res = 1;
        if(exponentValue >=0)
        {
            Exponent exp = new Exponent(baseValue, exponentValue);
            res = (float)exp.positiveExponent();
        }
        else
		{
            // write your code here for negative exponentInput
            Exponent exp = new Exponent(baseValue, exponentValue);
            res = (float)exp.negativeExponent();
        }
        return res;
    }
}

Happy Learning – If you require any further information, feel free to contact me.

Share your love
Saurav Hathi

Saurav Hathi

I'm currently studying Bachelor of Computer Science at Lovely Professional University in Punjab.

πŸ“Œ Nodejs and Android 😎
πŸ“Œ Java

Articles: 444

Leave a Reply

Your email address will not be published. Required fields are marked *