I'm horrible at C and I have to write a program for class that's due tomorrow that has to do with UPC codes. Basically I'm supposed to prompt the user for a 12 digit UPC and then check to see if it's valid or not. To do this I have to store the UPC in an array.
Now, I know how to check if the UPC is valid on paper. You have to add all the odd positions (for example, if the UPC is 268473619543 you would add 2, 8, 7, 6, 9 and 4 together) and then multiply that number by 3. Then I have to add all the even positions in the UPC and add that to the odd position's sum.
Anyway, what my problem is I can't figure out how to do this in code. How would I add the numbers while they are stored into an array?