From bf305d907e28675cf721d5ccb0824098144fa135 Mon Sep 17 00:00:00 2001 From: dima Date: Fri, 8 Nov 2024 15:27:08 +0300 Subject: [PATCH] fixes --- src/Main.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Main.java b/src/Main.java index 44ed138..eeeb6d6 100644 --- a/src/Main.java +++ b/src/Main.java @@ -12,6 +12,16 @@ public class Main { String operation = scanner.next(); float number2 = scanner.nextFloat(); System.out.print("Ответ:"); + String a = "+"; + String b = "-"; + String c = "*"; + String d = ":"; + String e = "^"; + + + if (operation != a && operation != b && operation != c && operation != d && operation != e) { + System.out.println("ошибка"); + } if (":".equals(operation)) { if (number2 != 0) { @@ -36,5 +46,9 @@ public class Main { float multiplication = number1 * number2; System.out.println(multiplication); } + if ("^".equals(operation)) { + double power = Math.pow(number1, number2); + System.out.println(power); + } } } \ No newline at end of file