Data update
This commit is contained in:
parent
5af6d93694
commit
796d366b97
455 changed files with 7413 additions and 1900 deletions
|
|
@ -1,27 +1,24 @@
|
|||
proc ISBN13check ISBN$ . valid .
|
||||
for i = 1 to len ISBN$
|
||||
currentChar$ = substr ISBN$ i 1
|
||||
if currentChar$ <> "-"
|
||||
digitCounter += 1
|
||||
func ISBN13check isbn$ .
|
||||
for c$ in strchars isbn$
|
||||
if c$ <> "-"
|
||||
ndigs += 1
|
||||
.
|
||||
currentDigit = number currentChar$
|
||||
if digitCounter mod 2 = 0
|
||||
currentDigit *= 3
|
||||
dig = number c$
|
||||
if ndigs mod 2 = 0
|
||||
dig *= 3
|
||||
.
|
||||
sum += currentDigit
|
||||
sum += dig
|
||||
.
|
||||
if sum mod 10 = 0
|
||||
valid = 1
|
||||
if sum mod 10 <> 0
|
||||
return 0
|
||||
.
|
||||
return 1
|
||||
.
|
||||
codes$[] = [ "978-0596528126" "978-0596528120" "978-1788399081" "978-1788399083" ]
|
||||
for code$ in codes$[]
|
||||
if ISBN13check code$ = 1
|
||||
print code$ & " is a valid ISBN"
|
||||
else
|
||||
valid = 0
|
||||
.
|
||||
.
|
||||
ISBNcodes$[] = [ "978-0596528126" "978-0596528120" "978-1788399081" "978-1788399083" ]
|
||||
for ISBN$ in ISBNcodes$[]
|
||||
call ISBN13check ISBN$ valid
|
||||
if valid = 1
|
||||
print ISBN$ & " is a valid ISBN"
|
||||
else
|
||||
print ISBN$ & " is not a valid ISBN"
|
||||
print code$ & " is not a valid ISBN"
|
||||
.
|
||||
.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue