move dmath, dsafe and nixctor to snippets/ directory

This commit is contained in:
Jeremy Baxter 2024-04-10 13:06:39 +12:00
parent 43b30424b1
commit 625968bef3
13 changed files with 0 additions and 0 deletions

View file

@ -1,29 +0,0 @@
import std.conv : to;
import std.stdio : stderr, writeln;
int
main(string[] args)
{
int f, i, n;
if (args.length < 3) {
stderr.writeln("usage: isfactor.d fac num");
return 1;
}
f = args[1].to!int();
n = args[2].to!int();
i = f;
while (i < n) {
i += f;
}
if (i == n) {
writeln(f, " is a factor of ", n);
return 0;
}
writeln(f, " is NOT a factor of ", n);
return 1;
}