Program to find last two digits of 2 ^ n | Java code to find last 2 digits of 2 ^ n ; Find the first digit ; Get the last digit from the number ; Remove last digit from number ; Get the last digit from the number ( last second of num ) ; Take last digit to ten 's position  i.e. last second digit ; Add the value of ones and tens to make it complete 2 digit number ; return the first digit ; Driver code ; pow function used
class Geeks { static long LastTwoDigit ( long num ) { long one = num % 10 ; num /= 10 ; long tens = num % 10 ; tens *= 10 ; num = tens + one ; return num ; } public static void main ( String args [ ] ) { int n = 10 ; long num = 1 ; num = ( long ) Math . pow ( 2 , n ) ; System . out . println ( " Last ▁ 2 ▁ digits ▁ of ▁ 2 ^ 10 ▁ = ▁ " + LastTwoDigit ( num ) ) ; } }