Power in c++ helps us to find power of number given by user.
What is c++ power function
The C++ pow() function raise x to the power of y, given two number, base and exponent which is “xy”. It returns x raised to the power of y. Exponent value is determined using the pow() c++ function and the power is calculated.
Syntax for C++ pow() :
C++ Power Function syntax:
C++ pow() Parameters:
- x – It is the base value.
- Y – It is a power value.
Return Value for c++ power function:
c++ pow() returns X raised to the power of y, as result.
Example of c++ power of a number
In this tutorial, you will learn to write pow c++ function to calculate the c++ power of 2 numbers using while & for loop.
we are using CodeBlocks compiler for debugging purposes. But you can use any C++ programming language compiler as per your availability.
Example 1:
Learn to calculate power in c++ using while loop.
Example 2:
Learn to calculate power in c++ using for loop.