Domanda

I have a few values

Quantity  := 5;
Quantity2 := 8;
percent   :=50;

so i want

Percent of Quantity + Quantity 2

which would be like : 50% of 13 = 6.5

I done it like this

  HowMuchDamage := trunc(percent*(Quantity + Quantity2)/100);

How can i make it round up? How can i make it round down?

È stato utile?

Soluzione

  • Floor(X) returns the highest integer less than or equal to X.
  • Ceil(X) returns the lowest integer greater than or equal to X.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top