Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. unsigned long function (int,int);
  4. int main()
  5. {
  6. int x,y;
  7. unsigned long z;
  8. cout<<"x=";
  9. cin>>x;
  10. cout<<"y=";
  11. cin>>y;
  12. z=function(x,y);
  13. cout<<"n"<<x<<"^"<<y<<"="<<z<<endl;
  14. system ("pause");
  15. return 0;
  16. }
  17. unsigned long function (int a,int b)
  18.  
  19. {
  20. if (b==0) return 1;
  21. if (b==1) return a;
  22. else return a*function(a,b-1);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement