[Help] Find Evens or Odds
Bois, I require assisstance.
The test platform for exercises in giving me 3/5 errors and I can't figure out why since they do not provide you with the issue.
Do you have any ideas?
My Code:
6 Replies
Examples:
1 10
odd 1 3 5 7 9
20 30
even 20 22 24 26 28 30
Hard to say -- the output you've given matches the specification you've given
Are you sure the upper bound is inclusive?
figured it out
apparatnly for example -5 % 2 = -1
Aah, negative values. Sneaky
The spec says to use Predicate. Presumably this is an exercise around using delegates
With
Predicate
.
The line to change
left
seems unncessary? The first time through the loop will sort that out.
It's also got the same bug that OP's had
It'd also be cleaner to use a for
loop with a loop variable IMO, rather than mutating one of the bounds
(which is what OP did)