Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
MathF.Floor() Method in C# with Examples
The MathF.Floor() method in C# is used to find the largest integer, which is less than or equal to the specified float value.
Syntax
Following is the syntax −
public static float Floor (float val);
Above, the Val is the floating-point value.
Example
Let us now see an example to implement the MathF.Floor() method −
using System;
class Demo {
public static void Main(){
float val = 45.67f;
float res = MathF.Floor(val);
Console.WriteLine("MathF.Floor() = "+res);
}
}
Output
This will produce the following output −
MathF.Floor() = 45
Example
Let us now see another example to implement the MathF.Floor() method −
using System;
class Demo {
public static void Main(){
float val = -10.33f;
float res = MathF.Floor(val);
Console.WriteLine("MathF.Floor() = "+res);
}
}
Output
This will produce the following output −
MathF.Floor() = -11
Advertisements
