Advertisement
SergeyPGUTI

6.1.2

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