Answers for "math.floor in java"

1

java math.floor example

import java.lang.*;

public class Math {

   public static void main(String[] args) {

      // get two double numbers
      double x = 60984.1;
      double y = -497.99;
   
      // call floor and print the result
      System.out.println("Math.floor(" + x + ")=" + Math.floor(x));
      System.out.println("Math.floor(" + y + ")=" + Math.floor(y));
      System.out.println("Math.floor(0)=" + Math.floor(0));
   }
}
Let us compile and run the above program, this will produce the following result −

Math.floor(60984.1)=60984.0
Math.floor(-497.99)=-498.0
Math.floor(0)=0.0
Posted by: Guest on June-20-2021
1

java math.floor

The floor of a floating point number is the largest integer that is <= to the number.
Posted by: Guest on January-25-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language