Jump to content

Luhn test of credit card numbers: Difference between revisions

no edit summary
No edit summary
Line 1,505:
Pass</pre>
 
=={{header|Burlesque}}==
 
<lang>
tt "Remove whitespace"vv
pe "Eval to number"vv
<- "Reverse digits"vv
XX "Split number into digits"vv
 
{
{ "Odd digits"vv
2EN
}
{ "Even digits"vv
2en
{
2.* "Double"vv
^^ 9.> "<test>=Duplicate greater than 9"vv
{
XX++ "Sum digits"vv
}if "If <test>"vv
}m[ "For each even digit"vv
}
}M- "Cool map. Create array of each branch applied to argument."vv
 
{++}m[ "Sum each block (odd & even)"vv
++ "Sum these"vv
[- "Last digit"vv
0== "Equal to zero"vv
Q "Pretty print"vv
</lang>
 
{{out}}
49927398716 1
49927398717 0
1234567812345678 0
1234567812345670 1
 
=={{header|C}}==
1

edit

Cookies help us deliver our services. By using our services, you agree to our use of cookies.