Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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;
} 
 
PREVIOUS NEXT
Tagged: #average
ADD COMMENT
Topic
Name
7+3 =