Advertisement
gosuodin

luythua

Jun 6th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int luythua(int a, int b) {
  5. if (b == 1) {
  6. return a;
  7. }
  8. else {
  9. return a*luythua(a, b - 1);
  10. }
  11. }
  12.  
  13. void main(){
  14. int a, b;
  15. cout << " nhap a , b: ";
  16. cin >> a >> b;
  17. cout <<luythua(a, b);
  18. system("pause");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement