1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Bingel [31]
3 years ago
11

2.ISBN. The International Standard Book Number (ISBN) is a 10-digit code that uniquely specifies a book. The rightmost digit is

a checksum digit that can be uniquely determined from the other 9 digits in the following manner: • Multiply the first digit by 10, the second by 9, the third by 8, and so on, down to the ninth digit by 2. . Add the values together. • Divide the sum by 11. What is the remainder? • If the remainder is 0, the checksum is 0; otherwise, subtract the remainder from 11 to get the checksum digit. If the checksum that you come up with is 10, then X is used as the checksum digit! As an example, the checksum digit corresponding to 020131452 is 5 since 5 is the only value of x between O and 10 for which 10*0+992 +840 + 7*1 + 6*3 + 5*1 + 4*4 + 35 + 2*2 + 1*x is a multiple of 11. Write an algorithm that reads an integer number of 9 digits and displays the checksum digit of the ISBN Hint 1: to extract the rightmost digit of a number use: COMPUTE digit AS number MODULUS 10 Hint 2: to remove the rightmost digit of a number use: COMPUTE number AS number / 10 Hint 3: for full credit use a loop to compute the sum Assume the input value is a 9-digit positive integer. Also assume that the input is a valid ISBN number without the checksum digit.
Engineering
1 answer:
iogann1982 [59]3 years ago
8 0

Answer

input isbn

n = isbn.length

if n != 10 then

return false;

end if

// Computing weighted sum of first 9 digits

sum = 0

i = 0

do

digit = isbn[i] - '0'

if 0 > digit or 9 < digit then

return false

end if

sum = sum + (digit * (10 - i))

i=i + 1

while(i < 9)

// Checking last digit.

last = isbn[9]

if last != 'X' and (last < '0' or last > '9') then

return false;

end if

// If last digit is 'X', add 10 to sum, else add its value.

if last == 'X' then

sum = sum + 10

else

sum = sum + (last - '0')

end if

// Return true if weighted sum of digits is divisible by 11.

if sum % 11 == 0 then

Print sum

Explanation:.

The above algorithm reada an ISBN number and print out the checksum.

It is implemented base on the instructions in the question.

Line 1 accepts an ISBN number

Line 2 Calculates the length

Line 3 checks if the length is 10.

If no the algorithm is stopped.

Line 8 initialise the checksum to 0

Line 12 through 17 Calculates the step 1 of the checksum using an iterative do statement

Line 19 reads the last character of the ISBN number

If the last character is not X and it is not a number, the algorithm is stopped

Line 24 to 28 adds or remove the last character from the checksum

The last 2 lines check if the checksum can be divided by 11.

If yes, the checksum is printed

You might be interested in
Pleaseeee help me with this!!
lilavasa [31]
Can you add a picture??
3 0
3 years ago
Tony works as a Sorter in a processing factory. Which qualifications does he most likely have?
svp [43]

Answer:

answer is B

Explanation:

7 0
3 years ago
Read 2 more answers
Here you go!!!!!!!!!!!!!!!!!1
sweet [91]

Answer:

Im confused, what does this mean

Explanation:

i mean, thx lol

3 0
3 years ago
Given the inherent costs of regulation it is safe to say that there is always a negative economic impact associated with regulat
Alexus [3.1K]

the answer is true.                                     <u>                    </u>                                                              

6 0
2 years ago
0 - 1"<br> -20<br> -15<br> -10<br> 5<br> 0 1 2 3<br> 0
faust18 [17]

Answer:

#WeirdestQuestionOfAllTime

Explanation:

8 0
3 years ago
Other questions:
  • Are spheroidized steels considered as composite? If so, what is the dispersed phase a)- No b)- Yes, Chromium Carbides c)- Yes, I
    12·1 answer
  • Use the overall heat-transfer resistance presented by the external air and the glass itself to determine the heat flux in W/m2 i
    10·1 answer
  • What considerations are included in the Preliminary Floodproofing/Retrofitting Preference Matrix?
    7·1 answer
  • Suppose that the voltage is reduced by 10 percent (to 90 VV). By what percentage is the power reduced? Assume that the resistanc
    10·1 answer
  • Explain why you chose the final design of your prototype and how it solved the identified need
    9·1 answer
  • A cylinder fitted with a movable piston contains water at 3 MPa with 50% quality, at which point the volume is 20 L. The water n
    8·2 answers
  • Describe in your own words the three strengthening mechanisms
    7·1 answer
  • PLEASE HELP WITH THIS ASAP! Thanks
    6·1 answer
  • Resistance depends on which three properties of a wire?
    15·1 answer
  • How pine are processed ????
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!