Mngaro Mwazenje

Mngaro Mwazenje

  • 1.8k
  • 80
  • 1.5k

print the range between given numbers, input by user

Feb 17 2020 5:26 AM
Create the method public static void PrintNumbersInRange(List<int> numbers, int lowerLimit, int upperLimit) in the exercise template. The method prints the numbers in the given list whose values are in the range [lowerLimit, upperLimit]. A few examples of using the method are supplied below.
  1. List<int> numbers = new List<int>();  
  2. numbers.Add(3);  
  3. numbers.Add(2);  
  4. numbers.Add(6);  
  5. numbers.Add(-1);  
  6. numbers.Add(5);  
  7. numnbers.Add(1);  
  8. Console.WriteLine("The numbers in the range [0, 5]");  
  9. PrintNumbersInRange(numbers, 0, 5);
The numbers in the range [0, 5]
3
2
5
1
anyone??

Answers (7)