Advertisement
gosuodin

giaithua

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