elements of arrays; functions

ok needing clarification on basics of arrays:

// assume array a and n (length of array) are of int type in

all functions //

function 1)

needing largest element of array a

int f (int a[], int n)

{ int largest =0;

largest = a[n-1];

return largest;

}

// I wrote this then thought we must assume user is prompted to input own element values, in that case how do you sort for largest element ?? //

function 2)

needing average of all elements of array a

int f(int a[], int n)

{ int sum=0, average =0;

int i;

for (i=0; i<n; i++)

{ sum += a[i];

}

average = (sum/2);

return average;

}

// now must assume user is prompted to input own element values//

function 3)

needing the # of positive elements in array a

int f(int a[], int n)

{ int num=0, element=0;

int i;

for (i=0; i<n; i++)

// okay here is where I am stumped; do I need to only use one counter ?? do I immediately test if remainder, then sum only those with no remainder???? not sure of how to code that //

Thanks for any help you can give.

It's been a few months since writing any programs in C.