By 22/07/2015 12 Comments

C# Floating Points

  • They contain fractional points values (e.g.: 1.80, 3.14 etc).
  • This type is being used to store fractional point values.
  • This type is especially useful for mathematical problems such as gravity of earth, pi value etc.
  • In C# double data type is being mostly used in many cases because it has a greater range than float.
float 32 1.5E–45 to 3.4E+38
double 64 5E–324 to 1.7E+308


using System;
namespace csharpBasic
    // Start class definition / declaration.
    class Program
        // Static main method void type declaration.
        static void Main(string[] args)

            /* float type variable initialization.
             * A character F is being used as a suffix which indicates that this is a float type.
            float pi = 3.14F;

            // Print variable.
            Console.WriteLine("Pi: " + pi);

            // double type variable initialization.
            double gravity = 9.8;
            Console.WriteLine("Gravity of earth is: " + gravity);

        } // End of main method definition. 
    } // End of class. 

Next Tutorial →

← Previous Tutorial

Posted in: C# Basics, C#.NET

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .