Why is the first task not checked.
package com.codegym.task.task04.task0409;
public class Solution {
public static void main(String[] args) {
displayClosestToTen(8, 11);
displayClosestToTen(7, 14);
}
public static void displayClosestToTen(int a, int b) {
int x = abs (a-10);
int y = abs (b-10);
if (x<y){
System.out.println(a+" is closest to ten.");
}
else if (y<x){
System.out.println(b+" is closest to ten.");
}
else
System.out.println("either of them.");
}
public static int abs(int a) {
if (a < 0) {
return -a;
} else {
return a;
}
}
}