Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Mutual-recursion/Vala/mutual-recursion.vala
Normal file
25
Task/Mutual-recursion/Vala/mutual-recursion.vala
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
int F(int n) {
|
||||
if (n == 0) return 1;
|
||||
return n - M(F(n - 1));
|
||||
}
|
||||
|
||||
int M(int n) {
|
||||
if (n == 0) return 0;
|
||||
return n - F(M(n - 1));
|
||||
}
|
||||
|
||||
void main() {
|
||||
print("n : ");
|
||||
for (int s = 0; s < 25; s++){
|
||||
print("%2d ", s);
|
||||
}
|
||||
print("\n------------------------------------------------------------------------------\n");
|
||||
print("F : ");
|
||||
for (int s = 0; s < 25; s++){
|
||||
print("%2d ", F(s));
|
||||
}
|
||||
print("\nM : ");
|
||||
for (int s = 0; s < 25; s++){
|
||||
print("%2d ", M(s));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue