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

Popular posts from this blog

How to Run Assembly Language Programming Code In Visual Studio 2019

How to Display Table of any Number in Assembly Language

How to Display Character in Assembly language