initial commit

master
dima 2024-11-04 18:01:40 +03:00
commit 922ace70f6
2 changed files with 68 additions and 0 deletions

29
.gitignore vendored Normal file
View File

@ -0,0 +1,29 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

39
src/Main.java Normal file
View File

@ -0,0 +1,39 @@
import java.util.Scanner;
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
Scanner a = new Scanner(System.in);
int number1 = a.nextInt();
String sing = a.next();
int number2 = a.nextInt();
System.out.print("Ответ:");
if (":" .equals(sing) && number2 != 0 ) {
float sum = (float) number1 / (float) number2;
System.out.println(sum);
}
if (":".equals(sing) && number2 == 0) {
System.out.println("на ноль делить нельзя");
}
if ("+" .equals(sing)) {
int sum = number1 + number2;
System.out.println(sum);
}
if ("-" .equals(sing)) {
int sum = number1 - number2;
System.out.println(sum);
}
if ("*" .equals(sing)) {
int sum = number1 * number2;
System.out.println(sum);
}
}
}