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);
    }
}



     
                     

Contact Us

REACH US

SERVICES

  • CODING
  • ON-LINE PREPARATION
  • JAVA & PYTHON

ADDRESS

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+ 919839520987
Email:info@alexsir.com