text: Exponential factorial of N | Java program for the above approach ; Function to find exponential factorial of a given number ; Stores the exponetial factor of N ; Iterare over the range [ 2 , N ] ; Update res ; Return res ; Driver code ; Input ; Function call
code: class GFG { static int ExpoFactorial ( int N ) { int res = 1 ; int mod = 1000000007 ; for ( int i = 2 ; i < N + 1 ; i ++ ) res = ( int ) Math . pow ( i , res ) % mod ; return res ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . println ( ( ExpoFactorial ( N ) ) ) ; } }