作者:条条大路种西瓜 | 来源:互联网 | 2023-05-19 17:25
Ineedtocheckifanintegerisdivisiblebyanotherintegerexactly.我需要检查一个整数是否可以被另一个整数整除。Ifno
I need to check if an integer is divisible by another integer exactly.
我需要检查一个整数是否可以被另一个整数整除。
If not I would like to round it up to the closest multiple of the number.
如果不是,我想将它四舍五入到最接近的数字。
Example:
var numberOne= 3
var numberTwo = 5
numberTwo
is not a multiple of numberOne
therefore I would like it to round numberTwo
up to 6.
numberTwo不是numberOne的倍数,因此我希望它可以将数字四舍五入到6。
How would I do this? Thank you
我该怎么办?谢谢
2 个解决方案