Sunday, March 15, 2020

BlueJ Program on ISBN


For Details of The Program: CLICK HERE

import java.io.*;
class Prog1
{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String str;
int digit,c=1,x=0,i,len;
char ch;
public void show()throws Exception
{
System.out.println("Enter the ISBN code:");
str=br.readLine();
len=str.length();
if(len!=10)
{
System.out.println("Invalid input.");
return;
}
for(i=len-1;i >=0;i--)
{
ch=str.charAt(i);
if(ch=='X')
digit=10;
else
digit=ch-48;
x=x+digit*c;
c++;
}
System.out.println("\nSum="+x);
if(x%11==0)

System.out.println("Leaves no remainder - valid ISBN code."); else
System.out.println("Leaves remainder - invalid ISBN code.");
}
public static void main(String args[]) throws Exception
{
Prog1 ob=new Prog1();
ob.show();
}
}


2013 Computer Practical Paper: CLICK HERE

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner