Generate a list of n consecutive composite numbers ( An interesting method ) | function to find factorial of given number ; Prints n consecutive numbers . ; Driver code
function factorial ( n ) { let res = 1 ; for ( let i = 2 ; i <= n ; i ++ ) { res *= i ; } return res ; } function printNComposite ( n ) { let fact = factorial ( n + 1 ) ; for ( let i = 2 ; i <= n + 1 ; ++ i ) { document . write ( fact + i + " " ) ; } } let n = 4 ; printNComposite ( n ) ;