The exp2()
function is used to compute 2 raised to the power of x
in C.
#include<math.h>
Below is the declaration of the exp2()
function,
double exp2(double x);
where x
is the exponent passed as a parameter to the function.
The function returns 2 raised to the power of x
as a double
value.
#include <math.h>#include <stdio.h>int main(){printf("Value of 2 raised to power 3: %f", exp2(3));printf("\nValue of 2 raised to power -2: %f", exp2(-2));return 0;}
Free Resources