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