Point to note is, it should only use if/else/elsif loops and / or comparison operators.
So no modulo operator, no division operator, no arithmetic operators, no bitwise foo... how would you determine oddness only with comparison? You would need an array which holds all odd values of |N. My computer can't.
In reply to Re: John Guttag's book - 2nd exercise. My attempt in Perl.
by shmem
in thread John Guttag's book - 2nd exercise. My attempt in Perl.
by pritesh_ugrankar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |