Q1. Function to Calculate Square (4 marks)
Write a function named FindSquare that:
-
Accepts an integer number
-
Calculates its square
-
Returns the result to the main program
Q2. Function to Find Maximum Value (6 marks)
Write a function named FindMaximum that:
-
Accepts two integer values
-
Compares them
-
Returns the larger value
Q3. Function for Discount Calculation (7 marks)
Write a function named CalculateDiscount that:
-
Accepts the original price and discount percentage
-
Calculates the discount amount
-
Returns the final price after discount
Q4. Function to Check Even or Odd (5 marks)
Write a function named IsEven that:
-
Accepts an integer number
-
Returns TRUE if the number is even
-
Returns FALSE if the number is odd
Q5. Function Using an Array (10 marks)
Write a function named FindTotal that:
-
Accepts an array of integers and its size
-
Calculates and returns the total of all elements in the array
Exam Tips for Functions
-
Functions must return a value
-
Use RETURN clearly
-
Match parameter types correctly
-
Use meaningful function names
