Clear the requirements
- First of all, the formula is not clear at all.
- What is ukl? Is it a variable, or is it the product of three variables (u, k, l) i.e. i * k * l?
- Same applies for ak and lbl.
- What is an "index number"? What is it used for? Is it represented by any variable in the formula? Do you have one "index number" or multiple?
Clear the code
The code has problems too.
#define E 2,71828
Euler's number (e) is 2.71828. The decimal sign is dot, not coma for the programming languages.
#define e 2.71828
Looping through array elements
int l[4] = { 1, 2, 3, 4 };
for (l = 1; l < 4; l++)
{
// ...
}
The code you provided will not work as you have defined the variable l as an array (int l[4];) but later you try to use it as a scalar, a simple integral number in the for loop.
To iterate through the elements of an array, you need to have an array indexer point to each of these elements one by one. In the blow example the indexer is i. We can access the ith element of the array by the l[i] expression.
const int l_count = 4;
int l[l_count] = { 1, 2, 3, 4 };
for (int i = 0; i < l_count; i++)
{
printf("%d\n", l[i]);
// ...
}
Please, note that the above code requires C++ to compile. If you want to use a C compiler, you have to use
#define l_count 4
instead.
One more important aspect of the code is that (in most programming languages) indexing arrays starts from 0. If you have n elements in the array, then the greatest index is n - 1. Hence the for loop starts from 0 and end if the index variable (i) is no longer less than the count of elements in l (l_count).
I hope this helps.