i tested this solution in IntelliJ and it worked there. not sure why the app didn't accept it. I used the abs method and the results display correctly...
package com.codegym.task.task04.task0409;
/*
Closest to 10
*/
public class Solution {
public static void main(String[] args) {
displayClosestToTen(8, 11);
displayClosestToTen(7, 14);
}
public static void displayClosestToTen(int a, int b) {
// write your code here
if (10 % abs(a) == 10 % abs(b))
System.out.println(a);
else if (10 % abs(a) < 10 % abs(b))
System.out.println(a);
else
System.out.println(b);
}
public static int abs(int a) {
if (a < 0) {
return -a;
} else {
return a;
}
}
}