0% found this document useful (0 votes)
49 views1 page

Algo Function Procedure

The document outlines a program that calculates the area of two 2D shapes: a rectangle and a circle. It includes two functions, 'calcAreaRectangle' for calculating the area of a rectangle given its width and height, and 'areaOfCircle' for calculating the area of a circle using its radius. The program also demonstrates the usage of these functions with example outputs for a rectangle with dimensions 4 and 5, and a circle with a radius of 75.5.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views1 page

Algo Function Procedure

The document outlines a program that calculates the area of two 2D shapes: a rectangle and a circle. It includes two functions, 'calcAreaRectangle' for calculating the area of a rectangle given its width and height, and 'areaOfCircle' for calculating the area of a circle using its radius. The program also demonstrates the usage of these functions with example outputs for a rectangle with dimensions 4 and 5, and a circle with a radius of 75.5.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd

Program To calculate area of a 2d shape

FUNCTION calcAreaRectangle (w : INTEGER, h : INTEGER) RETURNS INTEGER


DECLARE Area : INTEGER
Area ← w * h
RETURN Area
ENDFUNCTION

FUNCTION areaOfCircle(r : REAL) RETURNS REAL


CONSTANT pi ← 3.14
DECLARE Area : REAL
Area = pi * r * r
RETURN Area
ENDFUNCTION

result ← calcAreaRectangle(4, 5)
OUTPUT “The Area of a rectangle (w=4 & h=5) is: ” , result

cResult ← areaOfCircle(75.5)
OUTPUT “The Area of a circle (r=75.5) is: ” , cResult

You might also like