You could use a loop to subtract 2 from the number until it equals one or zero
Programmer Humor
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
bool isEven(int value) {
return (int)(((double)value / 2.0) % 1.0) * 100) != 50;
}
No need to reinvent the wheel. Use the isEven API!
assert IsEven(-2);
This joke was not written by the dude pictured. The author wrote a book of funny code jokes.
What you do is use a for loop to generate a million lines for you, then paste it in. Writing it manually is moronic. You can easily make it support numbers above 1,000,000 too this way, talking about scalable
I want to assess coders by lines written! The more the better!
apart from everything else, have they never heard of a switch statement
Switch statements is the next lesson in this bootcamp.
Oh. I thought that was Elixir until I zoomed in.
that's some good code right there
To be fair, the question is "Write a function that simultaneously determines if the number is even and works as a timer"
sleepSort meets sleepIsEven
I hope that the language's int
s are at most 32 bits. For 8 bits it could even be written by hand & the source code for a 32 bit version would only take up avg_line_len * 4GiB
space for the source code of the function. But it might take a bit of time to compile a version that supports the full range of 64 or 128 bit ints.
My mate, Paul, says all numbers after 700 repeat so we can stop there.
We just give them different names so you think they're going up.
all you have to to is throw an exception if the number is bigger than 100, who even needs numbers that big anyways?
When did Thor become the dev for Yandere Simulator?