Mod (short for Modulous) is a math operator that returns the Remainder of one number divided by another. In this case, 21 / 2 = 10 Remainder 1

[code]'It's pretty easy to loop through an array'Assume arrNumbers is an array with values declared in itFor i as integer = 0 to arrNumbers.Length - 1'Code here to figure out it arrNumbers(i) is Odd and count itNext i[/code]

I could have written the code for you in the last post, but I have a sneaking suspicion that your request is for a school assignment, and I am not about to write code for you to cheat at school (I did that when I was in school, and cheating got me no where).

Of course, even if this is not for school, writing it for yourself will clearly teach you better then me writing it and you copying it, so I will provide you with a suggestion and let you adapt this and the last post into your own...

If this is a school assignment, keep in mind:"Zero is an even number. An integer n is called *even* if there exists an integer m such that n = 2m, and *odd* if n+1 is even. From this, it is clear that 0 = (2)(0) is even. The reason for this definition is so that we have the property that every integer is either even or odd."So don't let your teacher/professor try and cheat you out of 100%, I had a teacher argue that with me once (for a strikingly similar assignment)

so... here's a suggestion, and you can write it yourself:

Create 2 variables to count the occurrences of both Even and Odd numbers...Dim iEven as IntegerDim iOdd as Integer

In my last post I showed you an If statement that can determine if a number is either Odd or Even. Below that I showed you a For loop that could iterate through an array.

Put the pieces together, add code to increment the values of iEven and iOdd so at the end iEven and iOdd will contain the count of Odd and Even occurrences.

I remember the good old days when I was still learning and every puzzle pozed was new grounds to tackle (insert nostalgia here)

Sure! not a problem:

I don't know how much you know about For loops. They are a very fundamental looping method in programming, and you will find them in most languages. Assuming you know how they technically work here is an explanation of that loop (if you want more information on how FOR loops work, hit google, there is some great explanations on them out there):

In the problem you are trying to solve (Count Odd and Even occurences in an Array of numbers) you will need to itterate through an array.

Assume arrNumber has been initialized with 10 values (as follows)

Dim arrNumber() as Integer = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}

From this line, we know that arrNumber(0) = 10, arrNumber(9) = 1, and calling arrNumber(10) will throw an exception (which crashes the program if you don't use exception handling). Arrays have a built in Property that return the "Count" of cells in the array, we call it like this:

arrNumber.Length

In our example, arrNumber.Length will return 10, the array bounds are 0-9

The loop that you have asked about, has i being declared on the fly (hence the For i as integer part). When the loop is done, i gets garbage collected and I cannot use it outside of that loop. I do this out of habit, and as far as I know there isn't any advantages to doing that over using a declared variable.

Now, the purpose of this For loop is to be able to iterate through EACH cell in the arrNumber array. We know that the first cell is 0 and the last cell is 9. We know that arrNumber.Length is 10. So, to go from 0 to 9, we have to call it from 0 to arrNumber.Length - 1

'In most cases Arrays go from 0 to .Length - 1, so this For Loop'structure will become second nature to you

'As far as I know there is no advantage to declaring i on the Fly'I simply do it from habit, and you could declare i before had like this:Dim i As Integer = 1241 'It doesn't matter what i is before the loop'On the first pass of the loop, it will be set to the Start value.For i = 0 to arrNumber.Length - 1 If arrNumber(i) Mod 2 = 1 Then iOdd = iOdd + 1 Else iEven = iEven + 1 End IfNext i[/code]