Computer Science – Programming concepts | e-Consult
Programming concepts (1 questions)
Login to see all questions.
Click on a question to view the answer
Function CalculateSum (a, b)
// This function calculates the sum of two numbers.
Sum = a + b
Return Sum
End Function
Explanation:
- Function Declaration: The function is declared as 'CalculateSum' and takes two parameters, 'a' and 'b'.
- Comment: A comment is included to explain the function's purpose.
- Calculation: The sum of 'a' and 'b' is calculated and stored in the variable 'Sum'.
- Return Statement: The 'Return Sum' statement returns the calculated sum as the output of the function.