Skip to content

Commit 2228c84

Browse files
committed
added ISBNChecker\src\com\main\chkdgt\ISBNCheckDigit.java
1 parent 08213bd commit 2228c84

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.main.chkdgt;
2+
3+
import java.util.Scanner;
4+
5+
public class ISBNCheckDigit {
6+
public static String[] ISBN;
7+
8+
public static void main(String[] args) {
9+
System.out.println("Enter ISBN:");
10+
Scanner sc = new Scanner(System.in);
11+
12+
int SUM = 0;
13+
ISBN = sc.nextLine().split("");
14+
for(int i = 0; i<ISBN.length-1; i++){
15+
SUM = SUM + (Integer.parseInt(ISBN[i]) * (ISBN.length-i));
16+
}
17+
if (11-(SUM % 11) == Integer.parseInt(ISBN[ISBN.length-1])){
18+
System.out.println("THIS IS A TRUE CODE");
19+
}
20+
21+
sc.close();
22+
}
23+
}

0 commit comments

Comments
 (0)