Last two digits of powers of 7 | Java program for the above approach ; Function to find the last two digits of 7 ^ N ; Case 4 ; Case 3 ; Case 2 ; Case 1 ; Driver code ; Given Number ; Function Call
import java . io . * ; import java . util . * ; class GFG { public static String get_last_two_digit ( int N ) { if ( N % 4 == 0 ) return "01" ; else if ( N % 4 == 1 ) return "07" ; else if ( N % 4 == 2 ) return "49" ; return "43" ; } public static void main ( String [ ] args ) { int N = 12 ; System . out . println ( get_last_two_digit ( N ) ) ; } }