H
|
Hd_Mersintarim 1/4/2021 |
on edit as properties |
L
|
luchoadmin author 1/5/2021 |
on edit as properties make 0 for all your calculate fields value
|
![]() |
Sergey Kornilov admin 1/5/2021 |
In your code you always delete the amount by 5 so it is not surprising. I would suggest implementing your logic on paper first, it will be easier to understand the logic this. var avg = (n1 + n2 + n3 + n4 + n5) / ( (n1==0? 0:1) + (n2==0? 0:1) + (n3==0? 0:1) + (n4==0? 0:1) + (n5==0? 0:1));
|
L
|
luchoadmin author 1/8/2021 |
In your code you always delete the amount by 5 so it is not surprising. I would suggest implementing your logic on paper first, it will be easier to understand the logic this. I think you need to count the number of elements that are not 0 and divide it by this number. So if your have five numbers like n1, n2, n3, n4 and n5 here is the sample code: var avg = (n1 + n2 + n3 + n4 + n5) / ( (n1==0? 0:1) + (n2==0? 0:1) + (n3==0? 0:1) + (n4==0? 0:1) + (n5==0? 0:1));
|