function initializeArrayInt(array, length):
for i = 0 to length - 1:
array[i] = 0
function bonacciseries(n, m):
array[m]
i = 0
j = 0
if m >= n:
initializeArrayInt(array, m)
array[n - 1] = 1
i = n
while i < m:
j = i - n
while j < i:
array[i] = array[i] + array[j]
j = j + 1
end while
i = i + 1
end while
i = 0
while i < m:
output array[i]
output " "
i = i + 1
end while
else:
output "M >= N !!"
end if
function main():
n = 0
m = 0
output "N-bonacci numbers"
output "N-bonacci number to calculate?"
input n
output "How many series's numbers?"
input m
bonacciseries(n, m)
#include <stdio.h>
void initializeArrayInt(int vet[], int length) {
int i;
for (i = 0; i < length; i++) {
vet[i] = 0;
}
}
void bonacciseries(int n, int m) {
int a[m];
int i, j;
if (m >= n) {
initializeArrayInt(a, m);
a[n - 1] = 1;
i = n;
while (i < m) {
j = i - n;
while (j < i) {
a[i] = a[i] + a[j];
j = j + 1;
}
i = i + 1;
}
i = 0;
while (i < m) {
printf("%d ", a[i]);
i = i + 1;
}
} else {
printf("M >= N !!\n");
}
}
int main() {
int n, m;
printf("N-bonacci numbers\n");
printf("N-bonacci number to calc?\n");
scanf("%d", &n);
printf("How many series's numbers?\n");
scanf("%d", &m);
bonacciseries(n, m);
return 0;
}