HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JS Factorial of a Number</h1> <script> var num = 6; var i = 1; var factorial = 1; for(i=1; i <= num; i++) factorial *= i; if(num) document.write("Factorial of "+num+": "+factorial); else document.write("Factorial of 0: 0"); </script> </body> </html>
OUTPUT
×

Save as Private