Answer the question
In order to leave comments, you need to log in
Why does 5 times 5 give 251?
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Input a number: ");
int a = in.nextInt();
System.out.print("Input a number: ");
int b= in.nextInt();
System.out.println("Введите действия с числами\n 1.сложить\n 2.вычесть \n 3.Умножить \n 4.Поделить");
int t=in.nextInt();
switch (t) {
case 1:System.out.print(a+b);
case 2:System.out.print(a-b);
case 3:System.out.print(a*b);
case 4:System.out.print(a/b);
}
in.close();
}
}
Answer the question
In order to leave comments, you need to log in
You should probably put breeches
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Input a number: ");
int a = in.nextInt();
System.out.print("Input a number: ");
int b= in.nextInt();
System.out.println("Введите действия с числами\n 1.сложить\n 2.вычесть \n 3.Умножить \n 4.Поделить");
int t=in.nextInt();
switch (t) {
case 1:
System.out.print(a+b);
break;
case 2:
System.out.print(a-b);
break;
case 3:
System.out.print(a*b);
break;
case 4:
System.out.print(a/b);
break;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question