An ISBN ( International
Stanadar Book Number) is a ten digit code which uniquely identifies a
book.
The first nine digits represent the Group, Publisher and Title
of the book and the last digit is used
to check whehter ISBN is
correct or not. Each of the first nine digits of the code can take a
value
between 0 and 9. Sometimes it is necessary to make the last
digit equal to ten; this is done by
writing the last digit of the
code as X. To verify an ISBN, calculate 10 times the first digit,
plus
9 times the second digit, plus 8 times the third and so on
until we add 1 time the last digit.
If the final number leaves no
remainder when divided by 11, the code is a valid ISBN.
For example:
Example 1
INPUT CODE :
0201530821
OUTPUT : SUM = 99
LEAVES NO REMAINDER -
VALID ISBN CODE
Example 2
INPUT CODE : 035680324
OUTPUT : INVALID INPUT
Example 1
INPUT CODE :
0231428031
OUTPUT : SUM = 122
LEAVES REMAINDER -
INVALID ISBN CODE
ISC 2013 ~ Computer
Science Practicals
No comments:
Post a Comment