Created
May 14, 2025 13:22
-
-
Save Yagudin16/eb5638cab2752fb410b0e79c477ff648 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NumberComparison { | |
public static void main(String[] args) { | |
int a = 10; // Пример входных данных, можно изменить | |
int b = 5; // Пример входных данных, можно изменить | |
// Сравнение чисел | |
if (a > b) { | |
System.out.println("a > b"); | |
} else if (a < b) { | |
System.out.println("a < b"); | |
} else { | |
System.out.println("a = b"); | |
} | |
// Арифметические операции | |
System.out.println("Сложение: " + (a + b)); | |
System.out.println("Вычитание: " + (a - b)); | |
System.out.println("Умножение: " + (a * b)); | |
// Деление с проверкой на ноль | |
if (b != 0) { | |
System.out.println("Деление: " + ((double)a / b)); | |
} else { | |
System.out.println("Ошибка: деление на ноль"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment