tablespace

master
remy 2020-04-25 14:15:47 +02:00
parent 43de6c1949
commit 9a5f918d76
1 changed files with 12 additions and 14 deletions

View File

@ -27,17 +27,16 @@ def is_valid_isbn(isbn_code)
pp "check_digit_isbn10"
i = check = 0
t = 10
while i < 9
check = array[i].to_i * (t - i) + check
i = i + 1
end
while i < 9
check = array[i].to_i * (t - i) + check
i = i + 1
end
pp result = ( 11 - (check % 11)) % 11
if (result - array[9].to_i) == 0
pp "isbn10 is ok"
else
pp "isbn10 check key fail"
end
pp "isbn10 is ok"
else
pp "isbn10 check key fail"
end
elsif isbn_code.size ==13
pp "isbn13"
pp "check_digit_isbn13"
@ -52,10 +51,10 @@ def is_valid_isbn(isbn_code)
end
pp result = 10 - (check % 10)
if result - array[12].to_i == 0
pp "isbn13 is ok"
else
pp "isbn13 check key fail"
end
pp "isbn13 is ok"
else
pp "isbn13 check key fail"
end
else
pp "wrong size"
return false
@ -64,7 +63,6 @@ def is_valid_isbn(isbn_code)
pp "ko not only number"
return false
end
end