i am working on an assignment for class in which we enter a upc into a text box and it must be in the format mmmppp-c where c is the check digit. I need to validate the check digit by using this algorithm.
Calculate the sum of the odd-spaced digits (the 1st, 3rd, and 5th) Save that as Answer 1. Multiply Answer 1 by 3. Calculate the sum of the even-spaced digits (the 2nd, 4th, and 6th) and add this to answer1. The check digit should be whatever number you have to add to your last answer to get it up to the next multiple of ten.
example valid upc's are 111222-3, 333444-9
so anyone who knows how to do this please help me! =)