identify the purpose and components of the method represented in the pseudocode below:
num calcAvarage(num total)
declarations
num avarage
set avarage = total/2
return avarage
The method takes the sum of two numbers and returns the average.
Structure: a numerical variable average is declared, after which it is assigned a half-sum (which is the average for two numbers), after which the variable average is returned by the method.
Comments
Leave a comment