using System;
using System.Threading;
namespace KeyboardRecord
{
class Class1
{
[STAThread]
static void Main( string[] args )
{
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];
}
}
} |