C#C
C#3mo ago
SkullereQ

Basic C# question

using System;
namespace DecimalPart
{
internal class Program
{
static void Main(string[] args)
{
string number = Console.ReadLine();
double number2 = Convert.ToDouble(number);
double number3 = Math.Floor(number2);
double number4 = Math.Round(number2-number3,6);

Console.WriteLine($"Decimal part = {number4}");
}
}
this is my input:
13.62001
this is output that i should get:
Decimal part = 0.620010
how do i get 6 digits behind even when there is no 6 digits for example 26.389 and i want to get 0.389000?
This is what I'm getting:
Decimal part = 0.62001
Was this page helpful?