Find the Factorial of a number using HTML & JavaScript!

preview_player
Показать описание
Hey guys, in this video we are going to learn how to make a program using HTML and JavaScript that can find the factorial of any number.
--
Factorial, in mathematics, the product of all positive integers less than or equal to a given positive integer and denoted by that integer and an exclamation point. Thus, factorial seven is written 7!, meaning 1 × 2 × 3 × 4 × 5 × 6 × 7.
--
Code(JavaScript only):
var number=prompt("What number do you want to factorial?");
var counter=number-1;
var output=number;
for (counter = number - 1; counter (*greater than sign goes here*)= 1; counter = counter - 1) {
output = (output * counter);
}
alert("The factorial of the number "+number+" is "+output);
--
Music at the end : Arc North - Krista Marina
--
Make sure to like and subscribe to Coder Gautam for more great videos!
Рекомендации по теме