Last digit of Product of two Large or Small numbers ( a * b ) | Fthe unction to print last digit of product a * b ; Driver code
function lastDigit ( a , b ) { var lastDig = ( a [ a . length - 1 ] - ' ' ) * ( b [ b . length - 1 ] - ' ' ) ; document . write ( lastDig % 10 ) ; } var a = " " , b = " " ; lastDigit ( a , b ) ;