Program to find the last digit of X in base Y | Java Program to find the last digit of X in base Y ; Function to find the last digit of X in base Y ; Driver code
class GFG { static void last_digit ( int X , int Y ) { System . out . print ( X % Y ) ; } public static void main ( String [ ] args ) { int X = 55 , Y = 3 ; last_digit ( X , Y ) ; } }