This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Pis | |
{ | |
static int[] multi = { 3, 2, 9, 8, 7, 6, 5, 4, 3, 2 }; | |
public static int CalculaDigito(string pis) { | |
var m11 = multi.Zip(pis, (m, d) => m * (int)Char.GetNumericValue(d)).Sum() % 11; | |
return m11 < 2 ? 0 : 11 - modulo11; | |
} | |
} |