initial commit
commit
922ace70f6
|
@ -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
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue