Sunday, February 6, 2011

Example of Algorithm,Pseudocode, and Flowchart

Find the perimeter of a rectangle.The perimeter of the rectangle are given by the following formulas:



Perimeter=2*(length+width)



Algorithm:



1. Get the input variable length and width.

2. Calculate the perimeter by using the formula

perimeter=2*(length+width)

3. Display the perimeter.



Pseudocode:



START

Input length,width

Set the variable perimeter

perimeter=2*(length+width)

Print the perimeter

END





Flowchart:

No comments:

Post a Comment