C
C#8mo ago
Ewan

✅ Code for 2dp

Whats the code that allows you to multiply two numbers and then add them e.g. (1.20 x 2) + (2.40 x 3) and then results in the answer outputting at 2dp instead of a whole number?
9 Replies
Buddy
Buddy8mo ago
Huh?
Jimmacle
Jimmacle8mo ago
what is 2dp? decimal points?
Ewan
EwanOP8mo ago
yeah
Jimmacle
Jimmacle8mo ago
that's not part of the math, that's part of the output formatting
Ewan
EwanOP8mo ago
oh yeah thats what i meant
Jimmacle
Jimmacle8mo ago
like Console.WriteLine($"{result:F2}");
Ewan
EwanOP8mo ago
uhhh i think that was it?
Jimmacle
Jimmacle8mo ago
Standard numeric format strings - .NET
In this article, learn to use standard numeric format strings to format common numeric types into text representations in .NET.
Ewan
EwanOP8mo ago
oooo ok ill have a look thanks!
Want results from more Discord servers?
Add your server