#include<stdio.h>
void check(char ID[18])
{
int i,t=0,s;
int aw[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};
int aXY[11]={1,0,10,9,8,7,6,5,4,3,2};
for(i=0;i<18;i++)
t+=ID[i]*aw[i];
s=t%11;
if(aXY[s]==ID[18])
printf("The input is right!\n");
else
printf("Errors! Please input again.\n");
}
void main(void)
{ char ID[18],i;
printf("Input an ID number:\n");
for(i=0;i<18;i++)
scanf("%d",&ID[i]);
check( ID);
}
Will_木
相关分类