next up previous
Next: About this document

centering17

Using the vi editor, write a C program on the Sun cluster that obeys the following specification.

An International Standard Book Number (ISBN) is a code of 10 characters. Each book published has its own unique ISBN. The last (tenth) character of an ISBN is a check character that is used to validate an ISBN. The check character is computed from the rest of the ISBN as follows: First, compute the sum of the first digit plus two times the second digit plus three times the third digit, ..., plus nine times the ninth digit. The last (tenth) character is the remainder when this sum is divided by 11. If the remainder is 10, the last character is X. For example, the ISBN 0806509597 is valid because:

displaymath27

and 249 mod 11 is 7, which is the last digit of the ISBN.

Write a function with one parameter that is an array of characters. The function returns true (1) if the array represents a valid ISBN and false (0) otherwise. Write a main program that prompts the user for an ISBN, passes the ISBN to the function, and reports whether or not the ISBN is valid.

More detailed specifications include:




next up previous
Next: About this document

Tim Wahls
Wed Mar 19 17:23:36 EST 1997