Answers for "c++ average"

C++
0

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;
}
Posted by: Guest on April-16-2021

Browse Popular Code Answers by Language