Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Do I Really Need a Programming Language?. Parent comment
Here you go, simple integer math, no programming necessary :) That said, this isn't optimisation, multiplication and division aren't intrinsically better than branching.
Your solution fails when price == 100 as sibling pointed out.
if (price == 100){ ...
Here you go, simple integer math, no programming necessary :) That said, this isn't optimisation, multiplication and division aren't intrinsically better than branching.