Answer to Question #186489 in C++ for abdullah

Question #186489

write a function to calculate the n power m using loop


1
Expert's answer
2021-04-27T18:33:31-0400
int power(int n, int 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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS