Advertisement
add1ctus

Степен

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