Calculation with rounding to an integer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Calculation with rounding to an integer

Options for calculating the percentage with rounding to an integer

26th Aug 2022, 4:37 AM
Николай Конушкин
Николай Конушкин - avatar
2 Answers
26th Aug 2022, 4:39 AM
BroFar
BroFar - avatar
0
The task is elementary and classical, calculate the discount on the product. That 's the formula I used to calculate: price-Math.Floor(price/100.0*discount) But I think there are probably more compact and beautiful options. Who thinks what? We can discuss it...
26th Aug 2022, 4:39 AM
Николай Конушкин
Николай Конушкин - avatar