Mega Code Archive

 
Categories / VB.Net / Development
 

Math Ceiling returns the smallest integral that is greater than or equal to the decimal number

Imports System Class Sample    Public Shared Sub Main()         Dim values() As Decimal = {-0.12d, -7.1d, -7.6d}         Console.WriteLine("  Value          Ceiling          Floor")         Console.WriteLine()         For Each value As Decimal In values            Console.WriteLine("{0,7} {1,16} {2,14}", _                              value, Math.Ceiling(value), Math.Floor(value))         Next       End Sub End Class