Skip to content

Instantly share code, notes, and snippets.

@picandocodigo
Created January 2, 2013 21:01
Show Gist options
  • Save picandocodigo/4438014 to your computer and use it in GitHub Desktop.
Save picandocodigo/4438014 to your computer and use it in GitHub Desktop.
Dígito verificador cédula
# ci = cédula
a = 0; (0..6).each { |i| a = a + ("2987634"[i].to_i * ci[i].to_i)}; puts (10 - (a % 10)).to_s[-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment