Question #186489

write a function to calculate the n power m using loop


Expert's answer

int power(int nint m) {
    int res = 1;
    for(int i=0; i<m; i++) {
        res *= n;
    }

    return res;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS