Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想以 5 为增量增加一个整数值。示例是:233 到 235、437 到 435,比如 298 到 300 之类的极端情况。我觉得我应该除以 5。
((i+2)/5)*5
给出 5 的最接近整数倍.
也许试试这个:
(((数字/5)*5) + (数字-((数字/5)*5)>2?5:0))