© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•5mo ago•
21 replies
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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ a question about basic C-sharp tutorials
C#CC# / help
4y ago
Basic stuff: c#
C#CC# / help
17mo ago
❔ Basic question in C# for a early beginner...
C#CC# / help
3y ago