Advertisement
pasholnahuy

А в степени Б

May 4th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int pow(int z, int n){
  7. if (n == 0){
  8.     return 1;
  9. }
  10. return z*pow(z, n-1);
  11. }
  12.  
  13. int main()
  14. {
  15.     int n, z;
  16.     cin >>  z >> n;
  17.  
  18.     cout  <<  pow(z, n) <<  endl;
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement