Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Demo2 {
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- double num = Double.parseDouble(console.nextLine());
- int lastDigit = (int) num % 10;
- int firstDigitAfterDEcimal = (int)(num * 10) % 10;
- int sum = lastDigit + firstDigitAfterDEcimal;
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment