Jump to content

ISBN13 check digit: Difference between revisions

m
Line 1,279:
=={{header|EasyLang}}==
<syntaxhighlight lang="text">
procfunc ISBN13check ISBNisbn$ . valid .
for ic$ =in 1strchars to len ISBNisbn$
currentChar$ = substrif ISBNc$ i<> 1"-"
if currentChar$ <> "-"ndigs += 1
digitCounter += 1
.
currentDigitdig = number currentCharc$
if digitCounterndigs mod 2 = 0
currentDigitdig *= 3
.
sum += currentDigitdig
.
if sum mod 10 =<> 0
validreturn = 10
else
valid = 0
.
return 1
.
ISBNcodescodes$[] = [ "978-0596528126" "978-0596528120" "978-1788399081" "978-1788399083" ]
for ISBNcode$ in ISBNcodescodes$[]
callif ISBN13check ISBNcode$ valid= 1
print ISBNcode$ & " is a valid ISBN"
if valid = 1
print ISBN$ & " is a valid ISBN"
else
print ISBNcode$ & " is not a valid ISBN"
.
.
2,042

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.