Java Program to Round of the Float value and return it in Integer in Java

Java Program to Round of the Float value and return it in Integer in Java

 

 Code:

import java.util.*;
public class RoundOfTheValue {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
float data = sc.nextFloat();
System.out.println(Math.round(data));
}
}

 Sample Input/Output:

 

Comments

Popular posts from this blog

Convert binary to decimal in c using built in function

Install nodeJs in linux

DFS in Complete Tree