Related Articles

Related Articles

Getting factorial of a number in Julia – factorial() Method
  • Last Updated : 21 Apr, 2020

The factorial() is an inbuilt function in julia which is used to return the factorial of the specified number n.

Syntax: factorial(n::Integer)

Parameters:

  • n: Specified number

Returns: It returns the factorial of the specified number n.

Example 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

# Julia program to illustrate 
# the use of factorial() method
  
# Getting the factorial of 
# the specified number
println(factorial(0))
println(factorial(1))
println(factorial(2))

chevron_right


Output:

1
1
2

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Julia program to illustrate 
# the use of factorial() method
  
# Getting the factorial of 
# the specified number
println(factorial(5))
println(factorial(7))
println(factorial(big(20)))
println(factorial(big(15)))

chevron_right


Output:

120
5040
2432902008176640000
1307674368000
My Personal Notes arrow_drop_up
Recommended Articles
Page :