public static void main(String[] args) {
displayClosestToTen(8, 11);
displayClosestToTen(7, 14);
}
public static void displayClosestToTen(int a, int b) {
// напишите тут ваш код
if ((10-a)<(10-b))
{
System.out.println(a);
}
if ((10-a)>(10-b));
{
System.out.println(b);
}
if ((10-a)=(10-b))
{
System.out.println(a);
}
public static int abs(int a) {
if (a < 0) {
return -a; public static void compare(int number) {
//напишите тут ваш код
if (number >=5)
{
System.out.println("Число больше 5");
System.out.println("Число равно 5");
}
else
{
System.out.println("Число меньше 5");
}
}
}
} else {
return a;
}
}
}
package com.javarush.task.task04.task0409;
/*
Ближайшее к 10
*/
public class Solution {
public static void main(String[] args) {
displayClosestToTen(8, 11);
displayClosestToTen(7, 14);
}
public static void displayClosestToTen(int a, int b) {
// напишите тут ваш код
if ((10-a)<(10-b))
{
System.out.println(a);
}
if ((10-a)>(10-b));
{
System.out.println(b);
}
if ((10-a)=(10-b))
{
System.out.println(a);
}
public static int abs(int a) {
if (a < 0) {
return -a; public static void compare(int number) {
//напишите тут ваш код
if (number >=5)
{
System.out.println("Число больше 5");
System.out.println("Число равно 5");
}
else
{
System.out.println("Число меньше 5");
}
}
}
} else {
return a;
}
}
}