Fthe unction to print last digit of product a * b
void lastDigit ( string a , string b ) { int lastDig = ( a [ a . length ( ) - 1 ] - '0' ) * ( b [ b . length ( ) - 1 ] - '0' ) ; cout << lastDig % 10 ; }