c++ average code example
Example: c++ average
// Average of a float
float avg(float numbers[]) {
int arraylength = sizeof(arr)/sizeof(arr[0]);
float sum = 0;
for (int i = 0; i < arraylength; i++) {
sum += numbers[i];
}
return sum / arraylength;
}