I have the following programm calculating the binomial coefficient of two integers. But I want to change the programm, that it calculates and saves only the necessary coeffi
Do you want to keep your code afterall?
Because you can also compute the binominal coefficient recursively, which would reduce your function to these 4 lines:
static long binomi(int n, int k) {
if ((n == k) || (k == 0))
return 1;
else
return binomi(n - 1, k) + binomi(n - 1, k - 1);
}