Advertisement
SergeyPGUTI

4.1.5 == 3.2.7 задания одинаковые)

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