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

Square Structure Algorithm Design

The document outlines the steps for designing an algorithm to calculate the perimeter and area of a rectangle or square using a structure named 'square'. It includes initializing integer members for length, breadth, perimeter, and area, as well as user input for dimensions. Finally, it describes how to compute and display the perimeter and area using the appropriate formulas and printf function.

Uploaded by

Summary
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Square Structure Algorithm Design

The document outlines the steps for designing an algorithm to calculate the perimeter and area of a rectangle or square using a structure named 'square'. It includes initializing integer members for length, breadth, perimeter, and area, as well as user input for dimensions. Finally, it describes how to compute and display the perimeter and area using the appropriate formulas and printf function.

Uploaded by

Summary
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Algorithm design

1. First, we construct a structure with name square and initialize integer members length(l),
breadth(b), perimeter(p) and area(a).
2. Also, we will create a structure variable s.
3. Now we will ask the user to input the length and breadth of the rectangle/square by the use
of scanf(“%d %d”, &l &b).
4. We will define the value of perimeter and area by using their respective formula i.e.
s.p=2*(s.l+s.b) and s.a=(l*b)
5. Using printf function will print the inputs and perimeter and area as outputs

You might also like