Answer to Question #235479 in C++ for Flyyboyy

Question #235479
How do I write an algorithm, pseudocode and flowchart to find the perimeter and area of a regular polygon
1
Expert's answer
2021-09-10T07:18:24-0400
 Brief Algorithm.
1. Get the number of sides of the polygon and the length of the side.
2. Checking the correctness of the entered data. Displaying a message in
   case of erroneous input.
3. Calculating the perimeter of a polygon using the formula:
   P = a*n, where 
   a - polygon side length
   n - number of sides of a polygon
4. We calculate the radius of the inscribed circle by the formula:
   r = a/(2*Tan(180/n))
   We take into account the fact that when calculating the tangent,
   the value is taken in degrees
5. We calculate the area of the polygon using the formula:
   S = Pr/2
6. We display the obtained results of the perimeter and area


Pseudocode
START
INPUT a,n
\\ check correct input
IF (a>0, n is integer,n>0)
   P = a*n
   r = a/(2*Tan(180/n))
   S = Pr/2
   OUTPUT P,S
ElSE
   OUTPUT message incorrect data entry
ENDIF
END

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS