thisisafakebuddy1

Untitled

Dec 29th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. # viet pseudo code thoi
  2.  
  3. # cach su dung vong lap
  4. # tinh cap so nhan thu i cua day so : a, ar, ar2, ar3 ...
  5. # nguoi dung nhap vao so i
  6. global result
  7. global r
  8. global a
  9. result = a
  10. if i == 0
  11. return a
  12. for j = 0 in i:
  13. result = result * r
  14. return result
  15.  
  16.  
  17.  
  18. # cach su dung de qui
  19. # i van la do nguoi dung nhap vao
  20. int function recursive(int i)
  21. if ( i == 0)
  22. return a
  23. else if ( i == 1 )
  24. return a * r
  25. else
  26. return r * recursive(i - 1)
  27.  
  28.  
  29. # minh k biet cai nao nhanh hon?
Advertisement
Add Comment
Please, Sign In to add comment