Code is copied!
Program to calculate the sum of last digits of two numbers entered by the user JAVA
Write a Program to calculate the sum of last digits of two numbers entered by the user.
import java.util.*;
class sum
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter first number");
int x = sc.nextInt();
System.out.println("Enter second number");
int y = sc.nextInt();
int d1 = x%10;
int d2 = y%10;
int sum = d1 + d2;
System.out.println("Sum is =" +sum);
}
}