import java.util.Scanner;
// The main method must be ihe main method must be in a class named "Main".
public class Main {
public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
System.out.println("Ingrese primer numero entero");
int a = teclado.nextInt();
System.out.println("Ingrese segundo nmero entero");
int b = teclado.nextInt();
System.out.println("===Menu===");
System.out.println("1. Suma");
System.out.println("2. Resta ");
System.out.println("3. Mutiplicacion ");
System.out.println("4. Division ");
System.out.println("Ingresa numero para la operacion");
int num = teclado.nextInt();
if (num == 1) {
System.out.println("La suma es: " + (a+b));
} else if (num == 2) {
System.out.println("La resta es: " + (a-b));
} else if (num == 3) {
System.out.println("La multplicacion es: " + (a*b));
} else if (num == 4) {
if (b == 0) {
System.out.println("No es posible dividir en 0");
} else {
System.out.println("La division es: " + ((double) a/b));
}
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: