Write a program which will raise any number x to a positive power n. Obtain values of x and n from the users. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a program which will raise any number x to a positive power n. Obtain values of x and n from the users.

9th Sep 2016, 3:29 PM
Praveen
3 Answers
9th Sep 2016, 3:57 PM
Zen
Zen - avatar
+ 1
Where is the fun if you can use pow?
9th Sep 2016, 4:08 PM
Zen
Zen - avatar
0
#include<iostream> #include<cmath> using namespace STD; main() { float x,y,result; cout<<"ENTER BASE AND POWER\n "; cin>>x>>n; result=pow(x,n); cout<<result; }
9th Sep 2016, 3:37 PM
Sri Surya
Sri Surya - avatar