Java program to round off the decimal number using the library method
// Java program to round off the decimal number
// using the library method
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner X = new Scanner(System.in);
double num = 0;
System.out.print("Enter number: ");
num = X.nextDouble();
System.out.print("Number after round off: " + Math.round(num));
}
}
Output
Enter number: 34.567
Number after round off: 35