namespace KeyboardRecord
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
string a = Console.ReadLine();
if (a.Length!=15)
{
Console.WriteLine("Please input correct idnumber");
}
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 strTemp;
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];
}
}
}