Pentanacci Numbers | Recursive function to find the Nth Pentanacci number ; Function to print the Nth Pentanacci number ; Driver code
function printpentaRec ( n ) { if ( n == 0 n == 1 n == 2 n == 3 n == 4 ) return 0 ; else if ( n == 5 ) return 1 ; else return ( printpentaRec ( n - 1 ) + printpentaRec ( n - 2 ) + printpentaRec ( n - 3 ) + printpentaRec ( n - 4 ) + printpentaRec ( n - 5 ) ) ; } function printPenta ( n ) { document . write ( printpentaRec ( n ) + " " ) ; } let n = 10 ; printPenta ( n ) ;