public class CloseToTen{
public static void main(String[]args){
displayClosestToTen(8,12);
displayClosestToTen(7,14);
}
public static void displayClosestToTen(int a, int b){
//Write you code here
int x = a-10;
int y = b-10;
x=Math.abs(x);
y=Math.abs(y);
if (x<y)
System.out.println(a);
else if
System.out.println(b);
else if(x==y)
System.out.printlln(Math.random(a,b));
}
}
what is wrong in this code
Under discussion
Comments
- Popular
- New
- Old
You must be signed in to leave a comment
This page doesn't have any comments yet