git.samba.org
/
tridge
/
junkcode.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
added -C option to enable running on more than 1 node
[tridge/junkcode.git]
/
checkcode.c
1
int checkcode(char *code)
2
{
3
int i, sum;
4
5
sum = 0;
6
7
for (i=0;code[i];i++) {
8
sum += i%2==0 ? 3*code[i] : 2*code[i];
9
}
10
return sum % 10;
11
}
12
13
main(int argc, char *argv[])
14
{
15
printf("%s: %d\n", argv[1], checkcode(argv[1]));
16
}