Advertisement
FedchenkoIhor

Untitled

Dec 26th, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. public class Solution
  2. {
  3.     public static void main(String[] args)
  4.     {
  5.         closeToTen(8,11);
  6.         closeToTen(14,7);
  7.  
  8.     }
  9.  
  10.     public static void closeToTen(int a, int b)
  11.     {
  12.         if(abs(a)>abs(b))
  13.             System.out.println(a);
  14.         if(abs(a)<=abs(b))
  15.             System.out.println(b);
  16.  
  17.     }
  18.  
  19.     public static int abs(int a)
  20.     {
  21.         if (a < 0) {
  22.             return -a;
  23.         } else {
  24.             return a;
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement