The goal for this exercise is to start writing recursive code. You’ll start here, with a task that resembles previous code samples that you’ve seen, but that is different enough that you (hopefully) will have to give the task some thought.
For this exercise, you need to implement the PrintEvenNumbers_Iteratively method in the provided RecursiveMethods class.
This class should be found in the Student_Answers.cs file. This class will print out only even numbers, from N down to 0 (including zero), using a perfectly normal loop. The objective here is to code up the problem in a simple, straight-forward way that will allow you visually see what work is being done at each step of the program.
You
may want to use the Recursively_Printing_Even_Numbers.RunExercise
method (in the
Student_Answers.cs file) to informally test this yourself.
Once
you’ve done that, implement the PrintEvenNumbers_Recursively
method in your
RecursiveMethods
class. This should print out only even numbers, from N down to 0
(including zero), but this time will do so recursively.
What you need to do for this exercise:
PrintEvenNumbers_Iteratively
method to print even numbers using a loopPrintEvenNumbers_Recursively
method that will print even numbers recursively.NUnit_Tests_PrintEven_Recursive
class. They should all
pass at this point, and if not, then you should fix your program so that
those tests do pass. You can run the tests using the NUnit support in
the provided starter project.