text: Third last digit in 5 ^ N for given N | Function to find the element ; if n < 3 ; If n is even return 6 If n is odd return 1 ; Driver code
code: < ? php function findThirdDigit ( $ n ) { if ( $ n < 3 ) return 0 ; return $ n & 1 ? 1 : 6 ; } $ n = 7 ; echo findThirdDigit ( $ n ) ; ? >