Math.ceiling Function in VB.NET

What is the use of math.ceiling() in VB.NET?

Explanation

Math.Ceiling Function

Math.Ceiling() Mathematical Function in Visual Basic.net 2008 is used to return an integer greater than or equal to the specified number.
Syntax:

Math.Ceiling(Number)

In the above syntax Number specifies the number to find the ceiled value.
Example:

Module Module1
Sub Main()
Console.WriteLine("Ceiled value of 1.15 is: "
& Math.Ceiling(1.15))
Console.WriteLine("Ceiled value of 0.15 is: "
& Math.Ceiling(0.15))
Console.WriteLine("Ceiled value of 1.00 is: "
& Math.Ceiling(1))
Console.ReadLine()
End Sub
End Module
Result:

Ceiled value of 1.15 is: 2
Ceiled value of 0.15 is: 1
Ceiled value of 1.00 is: 1

In the above example, the decimal values are ceiled to next higher integer, and the integer '1' is ceiled to '1'.

Visual Basic Tutorial


Ask Questions

Ask Question