Starting from:

$25

COMP1400-Lab 3 Solved

Objective: Understanding expressions

An International Standard Book Number (ISBN) is a unique number assigned to each book.  ISBN-10 has ten digits in 4 parts which the last digit is “check digit”. The check digit is base eleven, and can be 0-9 or X (instead of 10). To compute a missing check digit, each digit should be multiplied by its position in the number (counting from the right). Then, the sum of these products should

be divided by 11 to find the remainder. Finally, the check digit can  be found by subtracting the remainder from 11. 

For example, take the ISBN 0-201-53082-?: 

a)    First calculate sum of products: 0×10 + 2×9 + 0×8 + 1×7 + 5×6 + 3×5 + 0×4 +

8×3 + 2×2 = 98

b)    Remainder upon dividing by 11 is 10.

c)     Remainder is subtracted from 11.

d)    Check digit is 1.

For more information, watch the following Youtube video about finding the missing check digit of an ISBN number     https://www.youtube.com/watch?v=5qcrDnJg-98

Part A: RAPTOR Exercise

 

a)    Start RAPTOR and create a flowchart that asks the user to enter the first 9 digits of an ISBN-10, and displays the corresponding check digit.

b)    Run the flowchart with different numbers.

c)     Save the flowchart to a file named “isbn.rap” in the working directory on the PC you are using.

d)    Demonstrate the isbn.rap file to GA/TAs and run with different input values. 

 

Part B: C Programming Exercise

 

a)    Implement the algorithm as represented by “isbn.rap”, and write an equivalent C program that accomplishes what the flowchart does. The program, however, is allowed to call the scanf(...) function only once. A sample interaction is shown below:

 

      Enter the first nine digits of ISBN: 020153082          Check digit: 1

 



c)     Demonstrate the isbn.c file to GA/TAs and run with different input values. 

d)    Hint: To read single digits, we’ll use scanf with the %1d conversion specification.

 

More products