ID card 15TO18 algorithm

xiaoxiao2021-03-06  19

Using system; using system.threading;

A summary description of Namespace KeyboardRecord {///

/// Class1. /// class class1 {/// /// The primary entry point of the application. /// [stathread] static void main (string [] args) {// // Todo: Add code here to start the application // string a = console.readline (); if (a. Length! = 15) {Console.WriteLine ("please input correline";} else {console.writeline (getCheckcode (a));}} static string getCheckcode (String sfzh) {char [] strjiaoyan = {'1' , '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'}; int [] Intquan = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1}; string stratemp; int INTTEMP = 0; strtemp = sfzh.substring (0 , 6) "19" sfzh.substring (6); for (int i = 0; i <= strTemp.Length-1; i ) {INTTEMP = Int.Parse (Strtemp.Substring (i, 1)) * intquan [i];} intTemp = INTTEMP% 11; return strtemp strjiaoyan [INTTEMP];

}

转载请注明原文地址:https://www.9cbs.com/read-77200.html

New Post(0)