Professional Documents
Culture Documents
Form 4 Functions and Procedures
Form 4 Functions and Procedures
• Write a procedure to
1. Calculate the area of a triangle. The procedure must receive the base and
height as parameters.
2. Calculate the area of a circle. The procedure must receive the radius as a
parameter. (use 22/7 or 0.1429 for Pi)
3. Solve a quadratic equation. The procedure must receive the coeffects of a, b
and c as parameters. (1,-3,-10 x1 = 5, x2 = -2 ) (3,2,-1 x1 = 1/3 , x2 = -1 )
4. Output the Fibonacci sequence from 1,1,2,3…55. The procedure must receive
initial values (previous =1 and current = 1) as parameters.
5. Create a menu which will display the 4 options (of the modules created above)
and ask a user to choose an option to run and then request for the relevant
parameters before calling the required module.
Functions and procedures
Menu
4. Create a menu which will display the 4 options (of the modules created above)
and as a user to choose an option to run and then request for the relevant
parameters before calling the required module.