Skip to content

Commit eeb2ac0

Browse files
Create isbn.java
1 parent 191b634 commit eeb2ac0

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

isbn.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#https://www.facebook.com/lakshay.gulati.5/posts/3439658002768650
2+
# subscribed by Lakshay
3+
4+
import java.util.Scanner;
5+
6+
public class isbn {
7+
8+
public static void main(String[] args) {
9+
System.out.println("enter the 10 digit ISBN");
10+
long store[];
11+
long sum=0;
12+
store = new long[10];
13+
Scanner scan = new Scanner(System.in);
14+
String num= scan.next();
15+
long num1 = Long.parseLong(num);
16+
if(num.length()==10){
17+
for (int i=9;i>=0;i--){
18+
store[i]=(num1%10);
19+
num1=(num1/10);
20+
sum=sum+(store[i]*(i+1));
21+
}
22+
System.out.println(sum);
23+
if ((sum%11)==0) {
24+
System.out.println("Legal ISBN");
25+
}
26+
else{
27+
System.out.println("Illegal ISBN");
28+
}
29+
30+
}
31+
else{
32+
System.out.println("Illegal ISBN");
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)