Você está na página 1de 3

The distance of 2 points A(a1, a2) and B(b1, b2) is distance AB = ( Given the following polygon diagram.

(a1,a2)

) .

(g1,g2) (b1,b2)

(d1,d2) (c1,c2) (e1,e2) Use the above formula to calculate the perimeter of the above polygon. Prepare 1) Problem definition. Input Process a1,a2,b1,b2,c1,c2,d1,d2,e1,e2,f1,f2,g1,g2 (f1,f2)

AB=( BC=( CD=( DE=( EF=( FG=( GA=(

) ) ) ) ) ) )

( ( ( ( ( ( (

) ) ) ) ) ) )

Perimeter=AB+BC+CD+DE+EF+FG+GA
Output The perimeter of the polygon

2) Pseudocode
Basic Algorithm : START Read a1, a2, b1, b2, c1, c2, d1, d2, e1, e2, f1, f2, g1,g2 Calculate AB, BC, CD, DE, EF, FG, GA Calculate Perimeter Display Perimeter END

Detailed Pseudocode : START Display Enter the points : Read a1, a2, b1, b2, c1, c2, d1, d2, e1, e2, f1, f2, g1,g2 Calculate AB, BC, CD, DE, EF, FG, GA AB=( BC=( CD=( DE=( EF=( FG=( GA=( ) ) ) ) ) ) ) ( ( ( ( ( ( ( ) ) ) ) ) ) )

Perimeter=AB+BC+CD+DE+EF+FG+GA Display The perimeter of a polygon is: ,perimeter END

3)

Flowchart

Start

a1,a2,b1,b2,c1,c2,d1,d2, e1,e2,f1,f2,g1,g2

AB=( BC=( CD=( DE=( EF=( FG=( GA=(

) ) ) ) ) ) )

( ( ( ( ( ( (

) ) ) ) ) ) )

Perimeter=AB+BC+CD+DE+EF+FG+GA

The perimeter of polygon is

End

Você também pode gostar