How to Specify the Number of Decimal Places for a Double value in C# ?

01using System;
02using System.Collections.Generic;
03using System.Globalization;
04using System.Linq;
05using System.Text;
06 
07namespace AbundantcodeConsoleApp
08{
09    internal class Program
10    {
11        private static void Main(string[] args)
12        {
13            // How to Specify the Number of Decimal Places for a Double value in C# ?
14            double Input = 1007.8675;
15            Console.WriteLine(Input.ToString("F2", CultureInfo.InvariantCulture));
16            Console.ReadLine();
17        }
18    }
19     
20}

Post a Comment

0 Comments

Close Menu