16 Replies
using this code, the answer i get is 0
when i change the 18/35 to 35/35 it writes 100 which is correct
you're doing integer division, which has no fraction
how do i do it to 2dp?
oh?
you need to change one of the innermost numbers to a floating point number
e.g.
35.0
or 35f
oh i need the decimal?
at least one of the number literals has to be a floating point type
ooo ok that works! but now how do i do it to 2dp only?
i dont want a long list of numbers, i just want it to 2dp
you can't do math to only 2 decimal places, but you can change how the string is formatted
$"{dpmpercent:F2}"
can i round it to 2dp somehow?
what does the F2 mean?
it means display it as a fixed point number with 2 decimal places
oooo i see
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.
youre a god, it works!
ill have a look at this, thank you!! <:m_002_love:892466750199848971>
!close
Closed!
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.