identify the purpose and components of the method represented in the pseudocode below:
num calAverage(num total)
declarations
num average
set average = total/2
return average
The purpose of the function calAverage is to calculate and return the average of two numbers.
The sum of the two numbers is passed to the function as a parameter total.
The variable average is declared in the function and assigned a value obtained by dividing total by 2.
The function then returns average.
Comments
Leave a comment