Guest User

Solution

a guest
Nov 4th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Demo2 {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.         double num = Double.parseDouble(console.nextLine());
  7.  
  8.         int lastDigit = (int) num % 10;
  9.         int firstDigitAfterDEcimal = (int)(num * 10) % 10;
  10.  
  11.        int sum = lastDigit + firstDigitAfterDEcimal;
  12.         System.out.println(sum);
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment