Reference no: EM132194623
Question :
Write a C program to compute the check digit for the UPC.
Do it as follows:
Input digit 1 by itself.
Input digits 2-6 typed as a single 5 digit number, but read it in as 5 single digit numbers.
Input digits 7-11 the same way.
Compute the Checksum as follows: Add the odd digits together in one sum
Add the even digits together as a second sum
Multiply the first sum by three and add it to the second sum
Subtract 1 from this total
Find the remainder when divided by 10
Subtract this remainder from 9.
Print it. The screen should look like( underlined numbers are what you type in):
Enter first digit: 0
Enter first group of five digits: 13800
Enter second group of 5 digits: 15173
Check digit: 5
Try these UPC's: 0 51500 24128
0 31200 01005