If Any Required Program Please Ask In Comment I Will Help You(any Program in JAVA or C++) . . THANKS FOR VISITING MY BLOG!

If U LIKE MY PROFILE RAISE YOUR HAND IF U NOT RAISE UR STANDARD. Powered by Blogger.

Sunday, October 21, 2018

PROGRAM FOR POWER using RECURSION.



#include <iostream>
#include <conio.h>

using namespace std;

long Power(int A, int B);

int main()
{
int No, Pow;

cout << "Enter Any Number: ";
cin >> No;

cout << "Power of Number is: ";
cin >> Pow;

cout << "\nResult is: " << Power(No, Pow) << endl;

getch();
return 0;
}

long Power(int A, int B)
{
long Result;

if (B == 1)
return A;

Result = A * Power(A, B - 1);
return Result;
}

0 comments:

Post a Comment