Computer Science, asked by pragati8094, 2 days ago

WAP in Java to do the following...​

Attachments:

Answers

Answered by kajalpal1975
0

Answer:

import java.util.Scanner;

public class ISBN {

public static void main(String[] args) {

System.out.print("Enter ISBN number: ");

long isbn = new Scanner(System.in).nextLong();

int n, sum = 0;

if ((n = String.valueOf(isbn).length()) != 10) {

System.out.println("Illegal ISBN");

System.exit(0);

}

while (isbn > 0) {

sum += n-- * (isbn % 10);

isbn /= 10;

}

if (sum % 11 == 0) {

System.out.println("Legal ISBN");

} else {

System.out.println("Illegal ISBN");

}

}

}

Please mark me as the brainliest.

Similar questions