Sample test code - why is it bringing back an extra value

I'm practicing some online code examples for my potential interviews and I came across one code sample --> pass in 2 integers and bring back odd numbers between the range, inclusive.

Why is this bringing back 11? it shouldn't

Or, if I pass 96 and 97

List<int> list = new List<int>();

			int l = 3;
			int r = 9;

			List<int> t = Enumerable.Range(l, r).ToList();
			var oddNumbers = t.Where(num => num % 2 != 0);

			foreach (int i in oddNumbers)

			var res = list;

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kaufmed   ( ⚆ _ ⚆ )I asked the operating system what I could do to become a better programmer. It said, "Let me give you some pointers."Commented:
The 2nd parameter to Enumerable.Range says how many numbers to generate, not the maximum number. Therefore, the largest value in t is 12, which 11 is less than.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CamilliaAuthor Commented:
Oh, I made a mistake in it  I was just looking up Range. Thanks. That explains it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.