Power Calculator

serkan sendur -1 Tallied Votes 94 Views Share

Calculates Power to the number

function PowerCalculator(base,power)
    {
        var number = base;
        if(power == 1)
        return number;
        if(power == 0)
        return 1;
        for(var i=2;i<=power;i++)
        {
            number = number * base;
        }
        return number;
    }
rob-lozyniak 0 Newbie Poster

The built-in Math.pow() function already does this job.

Iamse 0 Newbie Poster

hi, im new here, and i cannot find the topic for Writing a program to find the power of any given number that is basic enough,im a beginner, if anyone can help me or just giving me a link to an existing thread like this..i will appreciate it very much... :)

Taywin 312 Posting Virtuoso

hi, im new here, and i cannot find the topic for Writing a program to find the power of any given number that is basic enough,im a beginner, if anyone can help me or just giving me a link to an existing thread like this..i will appreciate it very much...

Please create a new post instead of pulling an old thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.