综合题5_编程题5.html 483 B

1234567891011121314151617181920212223
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <script>
  10. // 求阶乘
  11. function factorial(n){
  12. var res = 1;
  13. for(var i = 1;i<=n;i++){
  14. res *= i;
  15. }
  16. return res;
  17. }
  18. console.log(factorial(12)-factorial(10));
  19. </script>
  20. </body>
  21. </html>