comparison between double values : double « Data Type « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Text;


class Program {
    static void Main(string[] args) {
        string comparison;
        Console.WriteLine("Enter a number:");
        double var1 = Convert.ToDouble(Console.ReadLine());
        Console.WriteLine("Enter another number:");
        double var2 = Convert.ToDouble(Console.ReadLine());
        if (var1 < var2)
            comparison = "less than";
        else {
            if (var1 == var2)
                comparison = "equal to";
            else
                comparison = "greater than";
        }
        Console.WriteLine("The first number is {0} the second number.",
                          comparison);

    }
}








2.26.double
2.26.1.Double: Epsilon, Positive/Negative Infinity and Max/Min Value
2.26.2.double const
2.26.3.comparison between double values
2.26.4.Specifying a Literal double
2.26.5.Exponential Notation