C
C#11mo ago
xbigi

✅ need quick help how to print 2 decimals

how can i print double numbers using {0:f2} in this case?
No description
7 Replies
xbigi
xbigiOP11mo ago
or any other way, i want to show "numbers are:" only once
Kouhai
Kouhai11mo ago
arr[i].ToString("f2")
Seoner
Seoner11mo ago
or Console.WriteLine(string.Format("{0:f2}", arr[i]));
xbigi
xbigiOP11mo ago
so it must become a string?
Seoner
Seoner11mo ago
Hover over WriteLine it's a method that requires a string, so you have to pass it a string, not a double, some methods might be overloaded (they have the same syntax but requires diffrent parameters) in case there is a overloaded method that can receive argument of your variable type, you don't have to parse
xbigi
xbigiOP11mo ago
whoops lol thank you!
MODiX
MODiX11mo ago
Use the /close command to mark a forum thread as answered
Want results from more Discord servers?
Add your server