Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • How to Validate ISBN ?

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 359
    Comment on it

    ISBN Number

    ISBN is an acronym for "INTERNATIONAL STANDARD BOOK NUMBER". It is a 10 digit Unique Number for Book Identifier.This number used for each new edition except Reprinting Books. Now the Question is How to verify this number is Legal ISBN or Not.

    For example : Lets assume that ISBN Number :99921-58-10-7.

    Sum=9*1+9*2+9*3+2*4+1*5+5*6+8*7+1*8+0*9+7*10. Note that 1,2,---10 refers to the position of digit which is multiplied with term at that position. If sum is Divisble by 11 then that number is said to be Legal ISBN else it is Illegal ISBN.

    Following Program illustrate the above logic.

    class ISBN {
     
        public static void main(String args[]) throws  {
            long isbn;
            int s = 0, i, t, d, dNO;
            String st;
            Scanner sc=new Scanner(System.in);
            System.out.print("Enter the 10-digit ISBN number: ");
            isbn = sc.next();
     
            // check the length is 10, else exit the program
            st = "" + isbn;
            if (st.length() != 10) {
                System.out.println("Illegal ISBN");
                return;
            }
            
            // compute the s of the digits
            s = 0;
            for (i = 0; i < st.length(); i++) {
                d = (int)(st.substring(i, i + 1));
                dNO = i + 1;
                t = dNO * d;
                s += t;
            }
     
            // check if divisible by 11 
            if ((s % 11) != 0) {
                System.out.println("Illegal ISBN");
            } else {
                System.out.println("Legal ISBN");
            }
        }
    }
    

     

    Java ISBN 10

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: