I have to write a program at school that allows the user to input a 7-digits of a GTIN-8
barcode and calculate check digit. To calculate the check digit the seven input numbers are multiplied by 3, 1, 3, 1 etc.
for (i = 0; i < 7; i++)
{
//Convert String to Character
ch = gtinNum[i];
//Convert Character to Integer
number = Convert.ToInt32(ch);
product = number * weights[i];
total = total + product;
}//end for loop
After that, the total is taken away from the nearest higher ten. For example if the total was 43 then it would be 50-43. In the simplest way possible, how do I round up to the higher ten?