An ISBN (International Standard Book Number) is a 10 digit number that is used to identify a book.
The first nine digits of the ISBN number are used to represent the Title, Publisher and Group of the book and the last digit is used for checking whether ISBN is correct or not.
The first 9 digits of it, can take any value between 0 and 9, but the last digits, sometimes may take value equal to 10; this is done by writing it as ‘X’.
To verify an ISBN, calculate 10 times the first digit, plus 9 times the second digit, plus 8 times the third digit 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.
Input : 007462542X Output : Valid 007462542X = 10*0 + 9*0 + 8*7 + 7*4 + 6*6 + 5*2 + 4*5 + 3*4 + 2*2 + 1*10 = 176 Since 55 leaves no remainder when divided by 11, hence it is a valid ISBN. Input : 0112112425 Output : Invalid 0112112425 = 10*0 + 9*1 + 8*1 + 7*2 + 6*1 + 5*1 + 4*1 + 3*4 + 2*2 + 1*5 = 71 Since 71 is not divisible by 11, given number is not a valid ISBN.
Now, we design a program to accept a ten digit code from the user and then we will check whether a number is ISBN or not. Display an appropriate message.
- Program to check if two strings are same or not
- Program to check Plus Perfect Number
- Program to check if all characters have even frequency
- Program to check for Peterson number
- Program to check Strength of Password
- Program to check the number is Palindrome or not
- Program to check congruency of two triangles
- Program to check if two given matrices are identical
- Program to check if a date is valid or not
- A Program to check if strings are rotations of each other or not
- Program to check Strong Number
- C Program to Check if a Given String is Palindrome
- Program to check if an array is bitonic or not
- Python program to check if given string is pangram
- Program to check if matrix is upper triangular
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : vt_m