Advertisement
LoanHoang

Untitled

Dec 12th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4. * Created by LENOVO on 12/12/2017.
  5. */
  6. public class Exercise_03_09 {
  7. public static void main(String[] args) {
  8. Scanner sc = new Scanner(System.in);
  9. System.out.println(" Enter 9 digits of ISBN: ");
  10. int d1 = sc.nextInt();
  11. int d2 = sc.nextInt();
  12. int d3 = sc.nextInt();
  13. int d4 = sc.nextInt();
  14. int d5 = sc.nextInt();
  15. int d6 = sc.nextInt();
  16. int d7 = sc.nextInt();
  17. int d8 = sc.nextInt();
  18. int d9 = sc.nextInt();
  19. int d10 = ((d1*1 ) + (d2*2) + (d3*3) + (d4*4) + (d5*5) + (d6*6) +(d7*7) + (d8*8) + (d9*9) % 11);
  20.  
  21. if (d10 == 10){
  22. System.out.println("The ISBN-10 number is " +d1+d2+d3+d4+d5+d6+d7+d8+d9+ "X");
  23.  
  24. }else{
  25.  
  26. System.out.println("The ISBN-10 number is " + d1+d2+d3+d4+d5+d6+d7+d8+d9);
  27.  
  28.  
  29.  
  30.  
  31. }
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement