Question: please write in C language: // upc.c program : 6. European countries use a 13-digit code, known as a European Article Number (EAN) instead of

please write in C language:

please write in C language: // upc.c program : 6. European countries

// upc.c program :

use a 13-digit code, known as a European Article Number (EAN) instead

6. European countries use a 13-digit code, known as a European Article Number (EAN) instead of the 12-digit Universal Product Code (UPC) found in North America. Each EAN ends with a check digit, just as a UPC does. The technique for calculating the check digit is also similar Add the second. fourth. sixth, cighth, tenth. and twelfth digits. Add the first, third. fifth. seventh. ninth. and eleventh digits. Multiply the first sum by 3 and add to the second sum Expressions Subtrac from the total. Compute the remainder when the adjusted total is divided by 10 Subtract the remainder from 9 For example, consider Glloglu Turkish Delight Pistachio & Coconut, which has an EAN of 8691484260008. The first sum is 6+18+2+0+0 17, and the second sum is 89+ 4 +46+0 31. Multiplying the first sum by 3 and adding the second yields 82. Subtac ing I gives 81. The remainder upon dividing by 10 is . When the remainder is subtracted from 9, the result is 8, which matches the last digit of the original code. Your job is to mod ify the upc.c program of Section 4.1 so tha it calculates the check digit for an EAN. The user will enter the first 12 digits of the EAN as a single number: Enter the first 12 digits of an EAN: 86914 8426000 Check diait: 8 upc.c /*Computes a Universal Product Code check digit / #include int main (void) first sum, second sum, total; printf ("Enter the first (single) digit: ") scanf ( " % ld", &d) ; printf ("Enter first group of five digits: " scanf ( " % 1d%ld%ld% ld%ld", &il, &i2, &13, &14 , &i5); printf ("Enter second group of five digits: ") The missing check digits are 8 (Jif) and 6 (0cein Spray). Chapter 4 Expressions first sumd12 i4 + jlj3 j5 secondsum i1 + 13 + 15 + j2 + j4; total 3first sum second_sum; - printf("Check digit: %d ", 9 - ((total - 1) % 10)); return 0

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!