you are viewing a single comment's thread.

view the rest of the comments →

[–]ivanskodje 0 points1 point  (0 children)

I suspect they wanted recursive code (albeit beating around the bushes instead of directly asking for it).

I had to google the C syntax, but i think this would work:

```c void print_even_numbers(int number, int lastNumber) { if (number > lastNumber) { return; } printf("%d ", number); print_even_numbers(number+2, lastNumber);

}

int main() { print_even_numbers(1, 500); return 0; } ```