Declare double type variable - CSharp Language Basics

CSharp examples for Language Basics:double

Description

Declare double type variable

Demo Code

using System;/*from   w  w  w.  j a va 2s .c om*/
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
   static void Main(string[] args)
   {
      double piApproximately = 3.14;
      // Pi is already available in C#
      double piMorePrecisely = Math.PI;
      double notCompletelyOne = 0.999999999999999999;
      Console.WriteLine("Pi value from our code: " + piApproximately);
      Console.WriteLine("Pi value from C#: " + piMorePrecisely);
      Console.WriteLine("This should not be exact one: " + notCompletelyOne);
   }
}

Result


Related Tutorials