here is my code example, my question is how to to let the output not to pass 1.0, and match the requirement in "while()"
using System;
public class Program
{
public static void Main()
{
double count = (double)0.0;
while(count < (double)1.0)
{
count = count + (double)0.1;
Console.WriteLine("{0:R}", count);
}
}
}
result:
0.1
0.2
0.30000000000000004
0.4
0.5
0.6
0.7
0.79999999999999993
0.89999999999999991
0.99999999999999989
1.0999999999999999
How to let the code not pass 1.0? (code is in C#)