var output = Convert.ToDecimal(amount / 4);
labelOutput.Text = "You need: " + System.Math.Round(output,0);
this code is part of a calculator for a game
“amount” is how much the user wants to make, and to make a single item, you need 4 pieces ( / 4)
for instance:
how much?: 20
20 / 4 = 5
“you need 5 pieces
but when i enter 21, still says 5 pieces but the users needs 6 pieces to make 21 items (4 for every item)
How can i round up the output to make it say 6 instead of 5 when the input is, in this case, 21 – 23?
(sorry if I didn’t explain it good enough)
1 Answer