Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double quickPow(double a, int n){
- double res = 1;
- while(n){
- if(n % 2 == 1){
- res *=a;
- }
- n/=2;
- a*=a;
- }
- return res;
- }
- int main()
- {
- double a;
- int n;
- cin>>a>>n;
- double x=quickPow(a,n);
- cout<<x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement