text: Number of Hamiltonian cycle | Function that calculates number of Hamiltonian cycle ; Calculating factorial ; Driver code
code: function Cycles ( N ) { var fact = 1 , result = 0 ; result = N - 1 ; var i = result ; while ( i > 0 ) { fact = fact * i ; i -- ; } return fact / 2 ; } var N = 5 ; var Number = Cycles ( N ) ; document . write ( " " + Number ) ;