Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
14
Task/Mutual-recursion/D/mutual-recursion.d
Normal file
14
Task/Mutual-recursion/D/mutual-recursion.d
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import std.stdio, std.algorithm, std.range;
|
||||
|
||||
int male(in int n) pure nothrow {
|
||||
return n ? n - male(n - 1).female : 0;
|
||||
}
|
||||
|
||||
int female(in int n) pure nothrow {
|
||||
return n ? n - female(n - 1).male : 1;
|
||||
}
|
||||
|
||||
void main() {
|
||||
20.iota.map!female.writeln;
|
||||
20.iota.map!male.writeln;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue