I am a new programmer, I would like to know how to round to the nearest hundredth. Here is the code
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Input first number: ");
double num1 = in.nextDouble();
System.out.print("Input second number: ");
double num2 = in.nextDouble();
System.out.println(num1 + " + " + num2 + " = " + (num1 + num2));
System.out.println(num1 + " - " + num2 + " = " + (num1 - num2));
System.out.println(num1 + " x " + num2 + " = " + (num1 * num2));
System.out.println(num1 + " / " + num2 + " = " + (num1 / num2));
}
}
please answer with the code to round to the nearest hundredth. Thank You.