Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The 13-digit International Standard Book Number (ISBN) is a unique code that identifies a book commercially. The last digit is a check digit used for

image text in transcribed

The 13-digit International Standard Book Number (ISBN) is a unique code that identifies a book commercially. The last digit is a check digit used for error detection. To calculate its value, each of the first twelve digits is alternately multiplied from left to right by 1 or 3. The products are summed up and divided by 10. The check digit is the remainder of the division subtracted from 10. If the result of the subtraction is 10 (because the remainder is zero), the check digit becomes zero. For example, consider the following ISBN code: 9789609319614 The product sum is (9*1 +7*3+ 8*1 + 9*3 + 6*1 + 0*3 + 9*1 +3*3+ 1*1 +9*3 + 6*1 + 1*3)= 126 The check digit is 10 - (126 % 10) = 10 - 6 = 4, which is the 13th digit. Write a C program that checks if a 13-digit code entered by a user is a valid ISBN code. Sample Code Execution: Red text indicates information entered by the user Enter a 13-digit ISBN code: 9789609319614 10 - (126%10) = 4. This is a valid ISBN code. Enter a 13-digit ISBN code: 9789609319624 10 - (129%10) = 1. This is not a valid ISBN code. Enter a 13-digit ISBN code: 9789609329620 10 - (130% 10) = 10. This is a valid ISBN code. You will complete lab 2 assignment when you attend your lab session

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions