Power of the number by using user defined function
Power of the number by using user defined function code is given below:
// Power of a number using user-defined function
#include<iostream>
using namespace std;
void power(int x, int y);
int main()
{
int num, exp;
cout << "enter any number : ";
cin >> num;
cout << "enter any exponent : ";
cin >> exp;
power(num, exp);
}
void power(int x, int y)
{
int c = 1;
for (int i = 0; i < y; i++)
{
c = x*y;
}
cout << "Answer is : " << c << endl;
}
Download:
To download thjs code click on the given link below:
Comments
Post a Comment