Program to find the last digit of X in base Y | Function to find the last digit of X in base Y ; Driver code
function last_digit ( X , Y ) { document . write ( X % Y ) ; } var X = 55 , Y = 3 ; last_digit ( X , Y ) ;