✅ need quick help how to print 2 decimals

how can i print double numbers using {0:f2} in this case?
No description
7 Replies
474122955031314442
474122955031314442OP13mo ago
or any other way, i want to show "numbers are:" only once
Kouhai
Kouhai13mo ago
arr[i].ToString("f2")
Seoner
Seoner13mo ago
or Console.WriteLine(string.Format("{0:f2}", arr[i]));
474122955031314442
474122955031314442OP13mo ago
so it must become a string?
Seoner
Seoner13mo 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
474122955031314442
474122955031314442OP13mo ago
whoops lol thank you!
MODiX
MODiX13mo ago
Use the /close command to mark a forum thread as answered

Did you find this page helpful?