Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Input four-digit number:");
- int x = sc.nextInt();
- int a = x/1000;
- int b = x%1000 / 100;
- int c = x%100/10;
- int d = x%10/1;
- if (a + b == c + d)
- System.out.println("It's a lucky ticket!!");
- else
- System.out.println("Sorry, your lose");
- }
- }
Add Comment
Please, Sign In to add comment