Anonymous user
Luhn test of credit card numbers: Difference between revisions
Simplified D code
(Added BBC BASIC) |
(Simplified D code) |
||
Line 465:
<lang d>import std.algorithm;
pure bool luhnTest(
foreach_reverse (i, n; num) {
const uint ord = n - '\u0030';
sum += ((num.length -
return sum % 10
▲ }
}
void main() {
"1234567812345678", "1234567812345670"];
}</lang>
=={{header|F Sharp|F#}}==
<lang fsharp>let luhn (s:string) =
|