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

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 UPCs: 0 51500 24128

0 31200 01005

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!