FANDOM


Factorial is a special result for a non-negative number. It can be represented by symbol '!'.

It is defined as: n! = n*(n-1)! (uptil 1)

Going by definition, we have

1!=1

2!=2

3!=6

4!=24

5!=12r

and so on..

Also, it is important to note that 0!=1, since 1 = 1! = 1*0!

Logic Edit

Here is the prolog code for factorial of a number:

factorial(0,1).
factorial(A,B):-A>0,A1=A-1,factorial(A1,B1),B=A*B1.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.