master
dima 2024-11-08 15:27:08 +03:00
parent 66ab37114a
commit bf305d907e
1 changed files with 14 additions and 0 deletions

View File

@ -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);
}
}
}