Guest User

Untitled

a guest
Dec 11th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public class Main {
  2. public static void main(String[] args) {
  3. Scanner sc = new Scanner(System.in);
  4. System.out.println("Input four-digit number:");
  5. int x = sc.nextInt();
  6. int a = x/1000;
  7. int b = x%1000 / 100;
  8. int c = x%100/10;
  9. int d = x%10/1;
  10. if (a + b == c + d)
  11. System.out.println("It's a lucky ticket!!");
  12. else
  13. System.out.println("Sorry, your lose");
  14.  
  15. }
  16. }
Add Comment
Please, Sign In to add comment