------------------------------------------------------------------------------
MC logo
Functional Average II
[^] Code Examples
------------------------------------------------------------------------------
<<Functional Average average3.c Functional Average III>>
#include <stdio.h>
double av(int n1, int n2, int n3)
{
        double sum;

        sum = n1 + n2 + n3;
        return sum / 3.0;
}

void print_it(int n1, int n2, int n3, double av)
{
        printf("Mean %d %d %d is %f\n",
                n1, n2, n3, av);
}
int main(void)
{
        int n1, n2, n3;

        printf("Enter: ");
        scanf("%d %d %d", &n1, &n2, &n3);

        print_it(n1, n2, n3, av(n1, n2, n3));
}

As in Java, the return type of void means there is nothing to return.
Reading: pp. 125-144 exc. arrays
<<Functional Average Functional Average III>>