The ceil() method is utilized to returns number which is greater than or equal to the given number.
Method Definition: def ceil: Float
Return Type: It returns a number which is greater than or equal to the given number.
Example #1:
// Scala program of Float ceil() // method // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying ceil method
val result = ( 5.4 ).ceil
// Displays output
println(result)
}
} |
Output:
6.0
Example #2:
// Scala program of Float ceil() // method // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying ceil method
val result = (- 3.8 ).ceil
// Displays output
println(result)
}
} |
Output:
-3.0