W.A.P. in c++ to power (). User have to insert no.and raised to the power using call by value. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

W.A.P. in c++ to power (). User have to insert no.and raised to the power using call by value.

1st Dec 2016, 12:49 PM
Manjeet Kumar
Manjeet Kumar - avatar
3 Answers
+ 1
#include<iostream> #include<maths.h> using namespace std; int main() { int a,b; // declaring two variables cout<<"Enter base and power : "; /* input base and power from user */ cin>>a>>b; int s; // variable to store result s=power(a,b); cout<<endl; cout<<" power "<<b<<"of the base "<<a<<"is : "<<s; return 0; } int power(int b,int n) { return(pow(n,b)); }
2nd Dec 2016, 11:41 AM
Dharm Vashisth
Dharm Vashisth - avatar
0
thanks..# Dharm
2nd Dec 2016, 11:43 AM
Manjeet Kumar
Manjeet Kumar - avatar
0
ok
2nd Dec 2016, 11:44 AM
Dharm Vashisth
Dharm Vashisth - avatar