#### Topic: To find an arithmetic average

Hello. And form usage requires to find an arithmetic average not elements of the set equal to zero
Vector X1, X2..., Xn and to count a number of elements with the nonnegative
Values (including and the elements equal to zero).

#### Re: To find an arithmetic average

It is required? Well do...

#### Re: To find an arithmetic average

That, tried to do?

#### Re: To find an arithmetic average

Roman Mejtes wrote:

that, tried to do?

While I can offer it only
List &lt;int&gt; arr = new List &lt;int&gt; {35, 55,-45, 0, 7, 57};
int m = 0;
float avr = 0;
int c = 0;
for (int i = 0; i &lt;arr. Count; i ++)
{
var tmp = arr [i];
if (tmp == 0) {continue;}
if (tmp&gt; 0) {m ++;}
c ++;
avr + = tmp;
}
avr = avr / (float) c;

#### Re: To find an arithmetic average

fantanol wrote:

I can offer only it

And at what here VB?

#### Re: To find an arithmetic average

The_Prist wrote:

it is passed...
And at what here VB?

Well though a sketch even from other environment. To represent algorithm

#### Re: To find an arithmetic average

fantanol;
And, well here to you this algorithm on VB:

``````Sub ttt ()
Dim arr (), m As Long, i As Long, tmp As Double, avr As Double
arr = Array (35, 55,-45, 0, 7, 57)
For i = 0 To UBound (arr)
tmp = arr (i)
If tmp&gt; 0 Then
m = m + 1
End If
avr = avr + tmp
Next
avr = avr / m
End Sub``````

#### Re: To find an arithmetic average

The_Prist wrote:

fantanol;
And, well here to you this algorithm on VB:

``````Sub ttt ()
Dim arr (), m As Long, i As Long, tmp As Double, avr As Double
arr = Array (35, 55,-45, 0, 7, 57)
For i = 0 To UBound (arr)
tmp = arr (i)
If tmp&gt; 0 Then
m = m + 1
End If
avr = avr + tmp
Next
avr = avr / m
End Sub``````

Only I without concept as with it to be further where to substitute and .

#### Re: To find an arithmetic average

fantanol;
Show to the teacher or plainly explain, what is necessary?

#### Re: To find an arithmetic average

by-pass wrote:

Show to the teacher or plainly explain, what is necessary?

show to the teacher, tell, what muzhiks with sql.ru are interested, what further?

#### Re: To find an arithmetic average

by-pass wrote:

fantanol;
Show to the teacher or plainly explain, what is necessary?

Here the task to find an arithmetic average not elements of the set equal to zero
Vector X1, X2..., Xn and to count a number of elements with the nonnegative
Values (including and the elements equal to zero).
It is all it is necessary to make on the form

Shocker. Pro wrote:

Show to the teacher, tell, what muzhiks with sql.ru are interested, what further?

Not in my case)

#### Re: To find an arithmetic average

fantanol wrote:

it is passed...
Not in my case)

you also are the teacher?

#### Re: To find an arithmetic average

Antonariy wrote:

it is passed...
You also are the teacher?

With such tasks I not be helped by the teacher