Computer Science, asked by ashutosh4397, 5 months ago

WAP to perform the following task by using only mathematical functions: Find and print 3 raised to the power 5. Assign 3 and 5 to suitable variables​

Answers

Answered by saxenaseema07054
1

Explanation:

C++ program to calculate pow(x,n)

#include<iostream>

using namespace std;

class gfg

{

/* Function to calculate x raised to the power y */

public:

int power(int x, unsigned int y)

{

if (y == 0)

return 1;

else if (y % 2 == 0)

return power(x, y / 2) * power(x, y / 2);

else

return x * power(x, y / 2) * power(x, y / 2);

}

};

/* Driver code */

int main()

{

Similar questions