Hexanacci Numbers | Java simple recursive program to print Nth Hexanacci numbers . ; Function to print the Nth Hexanacci number ; Driver code
import java . util . * ; class GFG { static int printhexaRec ( int n ) { if ( n == 0 n == 1 n == 2 n == 3 n == 4 n == 5 ) return 0 ; else if ( n == 6 ) return 1 ; else return ( printhexaRec ( n - 1 ) + printhexaRec ( n - 2 ) + printhexaRec ( n - 3 ) + printhexaRec ( n - 4 ) + printhexaRec ( n - 5 ) + printhexaRec ( n - 6 ) ) ; } static void printhexa ( int n ) { System . out . print ( printhexaRec ( n ) + "NEW_LINE"); } public static void main ( String [ ] args ) { int n = 11 ; printhexa ( n ) ; } }