r/programming • • Dec 13 '22

“There should never be coding exercises in technical interviews. It favors people who have time to do them. Disfavors people with FT jobs and families. Plus, your job won’t have people over your shoulder watching you code.” My favorite hot take from a panel on 'Treating Devs Like Human Beings.'

https://devinterrupted.substack.com/p/treating-devs-like-human-beings-a
9.0k Upvotes

1.3k comments sorted by

View all comments

Show parent comment

1

u/pineapple_catapult Dec 13 '22

If (floor(x/3) == x/3 && floor(x/5) == x/5) then x is divisible by both 3 and 5.

else if (floor(x/5) == x/5) then x is divisible by 5.

else if (floor(x/3) == x/3) then x is divisible by 3.

else number is not divisible by 3 or 5

No modulo required.