Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solution
- {
- public static void main(String[] args)
- {
- closeToTen(8,11);
- closeToTen(14,7);
- }
- public static void closeToTen(int a, int b)
- {
- int q = 10 - a;
- int w = 10 - b;
- if (abs(q) > abs(w))
- System.out.println(w);
- else
- System.out.println(q);
- }
- public static int abs(int a)
- {
- if (a < 0) {
- return -a;
- } else {
- return a;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment