You don't need an array. That array takes up more space than you need. It's really unnecessary. Just the array of 100 elements takes up 95 * 4 more bytes than my 5 variables.
On top of all of that, your ways of getting the digits won't ever work.
Storing the numbers is unnecessary because you are only summing those numbers, not using them again.
Because I didn't test my code first, I went back to test it. It worked exactly as I expected it too (only adding numbers that have an even number of digits).
Here is my previous code updated for user readability.
The array reserves space for all its elements. If you have two integers, they take up 8 bytes. If you have an array reserving space for two integers, that array is saving up 8 bytes of data for future use.
@Chriscpp
I have no idea what you think an even-digit number is, or what you are inputting, or what compiler you are using. You seem to be upset that I mentioned that the array is inefficient, for that I'm sorry. I'm just trying to help the OP with their issue.
This is what I get as output for my code. This comes from my compiler (Visual Studio 2008) and it comes straight from the console.
Enter number of numbers to input: 5
Enter number: 10
Enter number: 13
Enter number: 5
Enter number: 7
Enter number: 255
Sum of all even-digit numbers: 23
Press any key to continue . . .
10 and 13 are even-digit numbers and none of the rest have even digits. The sum of 10 and 13 is 23.
If it has two numbers E.G 11 = 2 number 1 and 1 thus even
If it has one number E.G 9 = 1 number 9 thus odd
If it has five number E.G 54365 = 5 number 5, 4, 3, 6 and 5 thus odd.
@Josue Molina
I agree with you. I don't know if this is what the OP wants or not, but I'm trying to help and explain my solution.
@Chriscpp
13 is an odd number. 27 is an odd number 2363 is an odd number. Each of these numbers have 2, 2, and 4 digits respectively. 2, 2, and 4 are all even numbers. I know what you are saying, and if my program operated the way you think it is supposed to, then yes you would be right. My program does not sum the number based on whether or not that number is odd or even. My program sums the number based on whether or not the number of digits that number has is odd or even.
@antirsi96
I'm sorry this erupted on your thread. You are not getting the answer you are looking for because of this, and for that I offer my sincerest apologies.