Last digit of Product of two Large or Small numbers ( a * b ) | CSharp implementation of the above approach ; Function to print last digit of product a * b ; Driver code
using System ; class Solution { public static void lastDigit ( String a , String b ) { int lastDig = ( a [ a . Length - 1 ] - '0' ) * ( b [ b . Length - 1 ] - '0' ) ; Console . Write ( lastDig % 10 ) ; } public static void Main ( ) { String a = "1234567891233" , b = "1234567891233156" ; lastDigit ( a , b ) ; } }