Use Remainder Operator on float point data type in CSharp
Description
The following code shows how to use Remainder Operator on float point data type.
Example
using System;//from w ww.j a v a2s . c o m
public class MainClass {
static void Main()
{
Console.WriteLine("0.0f % 1.3f is {0}", 0.0f % 1.3f);
Console.WriteLine("0.3f % 1.3f is {0}", 0.3f % 1.3f);
Console.WriteLine("1.0f % 1.3f is {0}", 1.0f % 1.3f);
Console.WriteLine("1.3f % 1.3f is {0}", 1.3f % 1.3f);
Console.WriteLine("2.0f % 1.3f is {0}", 2.0f % 1.3f);
Console.WriteLine("2.3f % 1.3f is {0}", 2.3f % 1.3f);
}
}
The code above generates the following result.