Skip to content
Related Articles

Related Articles

Scala Float ceil() method with example
  • Last Updated : 29 Oct, 2019
GeeksforGeeks - Summer Carnival Banner

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

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :