daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Feb 17th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Methods;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class CenterPoint {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int X1 = Integer.parseInt(scanner.nextLine());
  10.         int Y1 = Integer.parseInt(scanner.nextLine());
  11.         int X2 = Integer.parseInt(scanner.nextLine());
  12.         int Y2 = Integer.parseInt(scanner.nextLine());
  13.  
  14.         closerToCenter(X1, Y1, X2, Y2);
  15.  
  16.  
  17.     }
  18.  
  19.     static void closerToCenter(int x1, int y1, int x2, int y2) {
  20.  
  21.         if (Math.abs(x1) <= Math.abs(x2) && Math.abs(y1) <= Math.abs(y2)) {
  22.             System.out.printf("(%d, %d)", x1, y1);
  23.         } else {
  24.             System.out.printf("(%d, %d)", x2, y2);
  25.         }
  26.     }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top