文章
34
粉丝
109
获赞
7
访问
20.0k
#include <stdio.h>
#include <string.h>
int main()
{
char ch[20];
int num[17] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
char cnt[11] = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
while (scanf("%s", ch) != EOF)
{
if (strlen(ch) != 18)
{
printf("ID Wrong\n");
}
else
{
int all = 0;
for (int i = 0; i < 17; i++)
{
all += (ch[i] - '0') * num[i];
}
if (cnt[all % 11] == ch[17])
{
printf("ID Corrent\n");
}
else
{
printf("ID Wrong\n");
}
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发