Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Leonardo-numbers/D/leonardo-numbers.d
Normal file
20
Task/Leonardo-numbers/D/leonardo-numbers.d
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import std.stdio;
|
||||
|
||||
void main() {
|
||||
write("Leonardo Numbers: ");
|
||||
leonardoNumbers( 25 );
|
||||
|
||||
write("Fibonacci Numbers: ");
|
||||
leonardoNumbers( 25, 0, 1, 0 );
|
||||
}
|
||||
|
||||
void leonardoNumbers(int count, int l0=1, int l1=1, int add=1) {
|
||||
int t;
|
||||
for (int i=0; i<count; ++i) {
|
||||
write(l0, " ");
|
||||
t = l0 + l1 + add;
|
||||
l0 = l1;
|
||||
l1 = t;
|
||||
}
|
||||
writeln();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue