In this javaScript tutorial we are writing javaScript code to find factorials of a number.
factorial
factorial is multiplication of all whole numbers, it is nothing but multiplication of all numbers less than that number up to 1.
factorial number is denoted by ! this symbol.
a simple way For calculating factorial numbers through programming is traversing all numbers and multiplying it to the initial resultant variable.
We will travel 5-1 to find a factorial of 5!, it means traveling all numbers between 5-1 and multiplying all the numbers.
Basically for implementing this kind of logic we use loop statements.
If the resultant variable may contain zero or negative value that means whole logic is wrong , because the factorial is always calculating in positive number.
0 Comments