MathF.Ceiling() Method in C# with Examples
In C#, MathF.Ceiling(Single) is a MathF class method. This method is used to find the smallest integer , which is greater than or equal to the specified single or float value in the argument list.
Syntax: public static float Ceiling (float x);
Here, x is the float(Single) value whose ceiling value has to be calculated.
Return Type: This method return the smallest integral value which will be greater than or equal to x.
Example:
// C# program to illustrate the // MathF.Ceiling(Single) Method using System; class GFG { // Main method static void Main() { // taking float values float x1 = 33.00f; float x2 = 99.99f; // Calculate Ceiling values by // Using MathF.Ceiling() method float r1 = MathF.Ceiling(x1); float r2 = MathF.Ceiling(x2); // Print the original values // and Ceiling values Console.WriteLine("Input Value = " + x1); Console.WriteLine("Ceiling value = " + r1); // Print the original values // and Ceiling values Console.WriteLine("Input Value = " + x2); Console.WriteLine("Ceiling value = " + r2); } } |
Input Value = 33 Ceiling value = 33 Input Value = 99.99 Ceiling value = 100
Recommended Posts:
- MathF.Log() Method in C# with Examples
- MathF.Sin() Method in C# with Examples
- MathF.Tan() Method in C# with Examples
- MathF.Min() Method in C# with Examples
- MathF.Max() Method in C# with Examples
- MathF.Abs() Method in C# with Examples
- MathF.Cos() Method in C# with Examples
- MathF.Exp() Method in C# with Examples
- MathF.Pow() Method in C# with Examples
- Int64.GetHashCode Method in C# with Examples
- Int32.GetHashCode Method in C# with Examples
- Int32.CompareTo Method in C# with Examples
- Int16.Equals Method in C# with Examples
- Int16.GetHashCode Method in C# with Examples
- BitArray.RightShift() Method in C# with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



