![]() |
VOOZH | about |
In this article, we will learn how to write a C program to calculate the power of a number (xn). We may assume that x and n are small and overflow doesn't happen.
👁 calculate power of a number in C
A simple solution to calculate the power would be to multiply x exactly n times. We can do that by using a simple for or while loop.
8
Please visit the article Write the Program to Find pow(x,y) to know about more methods to calculate the power of a number.