ISBN13 check digit: Difference between revisions

Add EasyLang
(Add EasyLang)
Line 1,194:
978-1788399081: good
978-1788399083: bad</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight lang="text">
func ISBN13check ISBN$ . valid$ .
for i = 1 to len ISBN$
currentChar$ = substr ISBN$ i 1
if currentChar$ <> "-"
digitCounter += 1
.
currentDigit = number currentChar$
if digitCounter mod 2 = 0
currentDigit *= 3
.
sum += currentDigit
.
if sum mod 10 = 0
valid$ = "true"
else
valid$ = "false"
.
.
ISBNcodes$[] = [ "978-0596528126" "978-0596528120" "978-1788399081" "978-1788399083" ]
for ISBN$ in ISBNcodes$[]
call ISBN13check ISBN$ valid$
if valid$ = "true"
print ISBN$ & " is a valid ISBN"
else
print ISBN$ & " is not a valid ISBN"
.
.
</syntaxhighlight>
{{out}}
<pre>
978-0596528126 is a valid ISBN
978-0596528120 is not a valid ISBN
978-1788399081 is a valid ISBN
978-1788399083 is not a valid ISBN
</pre>
 
=={{header|Excel}}==
175

edits