Do you remember the good old point-and-click adventures? They provided plenty of puzzles and riddles with a compelling narrative. I loved them, possibly because I love riddles, puzzles, and this sort of challenge. So I was super excited when my employer supported the initiative of a Coding-Riddle-of-the-Week contest. This is the second issue and I’m going to present it here.
Produce a program which increments an integer variable by a value of 1 without using sum or increment operators.
You are pretty free to choose whatever integer size and type you prefer (I would say, but bool
), and whatever language you want. I stuck with C++ because it was quicker, but most of my solutions can be easily ported to other languages.
So, before continuing be sure to give some thought to this riddle to not spoil the fun.
Continue reading “Mom! My plus key is broken!”