diff --git a/src/Main.java b/src/Main.java index 5dbd8ac..44ed138 100644 --- a/src/Main.java +++ b/src/Main.java @@ -8,35 +8,33 @@ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); - int number1 = scanner.nextInt(); + float number1 = scanner.nextFloat(); String operation = scanner.next(); - int number2 = scanner.nextInt(); + float number2 = scanner.nextFloat(); System.out.print("Ответ:"); if (":".equals(operation)) { if (number2 != 0) { - float division = (float) number1 / (float) number2; + float division = number1 / number2; System.out.println(division); } else { System.out.println("На 0 делить нельзя"); } } - { - if ("+".equals(operation)) { - int addition = number1 + number2; - System.out.println(addition); - } + if ("+".equals(operation)) { + float addition = number1 + number2; + System.out.println(addition); + } - if ("-".equals(operation)) { - int subtraction = number1 - number2; - System.out.println(subtraction); - } + if ("-".equals(operation)) { + float subtraction = number1 - number2; + System.out.println(subtraction); + } - if ("*".equals(operation)) { - int multiplication = number1 * number2; - System.out.println(multiplication); - } + if ("*".equals(operation)) { + float multiplication = number1 * number2; + System.out.println(multiplication); } } } \ No newline at end of file