import java.util.Scanner; public class Arithmetic { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x, y; System.out.print("Enter integer value for x: "); x = in.nextInt(); System.out.print("Enter integer value for y: "); y = in.nextInt(); // display arithmetic results System.out.println(); System.out.println(x + " + " + y + " = " + (x + y)); System.out.println(x + " - " + y + " = " + (x - y)); System.out.println(x + " * " + y + " = " + (x * y)); System.out.println(x + " / " + y + " = " + (x / y)); System.out.println(x + " % " + y + " = " + (x % y)); System.out.println(); // now try it for doubles double a, b; System.out.print("Enter double (float) value for a: "); a = in.nextDouble(); System.out.print("Enter double (float) value for b: "); b = in.nextDouble(); // display arithmetic results System.out.println(); System.out.println(a + " + " + b + " = " + (a + b)); System.out.println(a + " - " + b + " = " + (a - b)); System.out.println(a + " * " + b + " = " + (a * b)); System.out.println(a + " / " + b + " = " + (a / b)); System.out.println(a + " % " + b + " = " + (a % b)); System.out.println(); } }