Advertisement
SergeyPGUTI

6.2.1

Oct 24th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. double power(double a,int n)
  6. {
  7.     if (n>=1)
  8.     return a=a*power(a,n-1);
  9.     else return 1;
  10. }
  11.  
  12. int main()
  13. {
  14.     int n;
  15.     double a;
  16.     cin>>a>>n;
  17.     cout<<power(a,n);
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement