C
C#7mo 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
Buddy7mo ago
Huh?
Jimmacle
Jimmacle7mo ago
what is 2dp? decimal points?
Ewan
EwanOP7mo ago
yeah
Jimmacle
Jimmacle7mo ago
that's not part of the math, that's part of the output formatting
Ewan
EwanOP7mo ago
oh yeah thats what i meant
Jimmacle
Jimmacle7mo ago
like Console.WriteLine($"{result:F2}");
Ewan
EwanOP7mo ago
uhhh i think that was it?
Jimmacle
Jimmacle7mo 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
EwanOP7mo ago
oooo ok ill have a look thanks!
Want results from more Discord servers?
Add your server