Open In App

Scala Float ceil() method with example

Last Updated : 29 Oct, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads