ISBN Number.
Program to check whether a given number is ISBN number or not.
- An ISBN(International Standard 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.
- 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 number, calculate 10 times the fist digit, plus 9 times the second digit, plus 8 times the third and so on until 1 time the last digit. If the final number leaves no remainder when divided by 11, the code is a valid number.
eg. 007462542X = (10*0)+(9*0)+(8*7)+(7*4)+(6*6)+(5*2)+(4*5)+(3*4)+(2*2)+(1*10)=176
Similarly 0764526413 and 0112362221
Similarly 0764526413 and 0112362221
SOURCE CODE
import java.io.*;
public class ISBN
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
System.out.println("Enter a 10 digit No.");
String str=br.readLine();
int l=str.length();
int n=0,isbn=0;
if(l==10)
{
for(int i=9,j=10;i>=0;i--,j--)
{
char ch=str.charAt(i);
if(ch>=48&&ch<=57)
{
n=ch-48;
}
else if(ch=='X')
{
n=10;
}
isbn=isbn+n*j;
}
if(isbn%11==0)
System.out.println("Yes,It is a ISBN No.");
else
System.out.println("No,It is not a ISBN No.");
}
else
{
System.out.println("Invalid");
}
}
}
If you want to download this program then Click Here
OUTPUT
If you have any question then leave a comment below I will do my best to answer that question.
muturlec_po Susan Ortega Crack
ReplyDeletebapcompmondse
VdiscolXlyb_wo Joe Flowers https://wakelet.com/@flatanstenic128
ReplyDeletetentscotiset