using system;
using system.threading;
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];
}
}
}
