Program 2
Power Function
Given Function/method pow need to return the x raised to the power n, with the help of stl function. You are required to fix logical errors in given code.
Note : Use STL Function only similar to power.
Input: x = 2.00000, n = 10
Expected Output: 1024.00000
Current output: 10.0000
Incorrect Code
Correct Code
Incorrect Code
double myPow(double x, int n) { return (x,n); }
Correct Code
#include <bits/stdc++.h> double myPow(double x, int n) { return pow(x,n); }
#include
Hey there,
Thanks for commenting.🙌💚