WAP in Java to print..!!
Avoid spam
Attachments:
Answers
Answered by
0
import java.io.*;
{
public static void main(String arg[])throws Exception
{
int m,i;
string n;
DataInputStream in=new DataInputStream(System.in);
System.out.print("enter a 10 digit ISBN Number");
n=in.readLine();
if(n.length()==10)
{
m=0;
for(i=1;i<11;i++)
{
m=m+i*n.charAt(i-1);
}
}
if(n.length!=10||(m%11)!=0)
System.out.print("illegal ISBN number");
else if((m%11)==0)
System.out.print("legal ISBN number");
}
}
Similar questions