array_average

array_average
Turn-in directory04_array_average/
Files to turn inarray_average.c
Allowed external functionsNone
Type of workFunction
  • Write a program which displays the alphabet in lowercase on standard output, starting from the character in variable start_char, followed by a newline.
  • To help you get started, we will provide some code for you to copy/paste/edit. Make sure you understand every line before you hand it in!
  • You need to write a function that takes an array of integers and its length as parameters and returns the average of the integers in the array.
  • If the array is empty (len == 0), the function should return 0.
#include <stdio.h>

int array_average(const int *a, const size_t len);

int main()
{
    int array[3] = {3, 22, 5};
    size_t len = 3;
    int result = array_average(array, len);
    printf("%d\n", result);
    return 0;
}

Example output:

$ ./a.out
10$