 # How to find area of circles and squares

This is pretty easy, but here is a tutorial on finding the area of squares and circles

## Squares

### Area

The algorithm for finding the area of a square is simple, (AB). It’s the same in Hopscotch. Using values as the A and B, you can find the square’s area in square pixels.

For example, say the square’s width is 90 and it’s height is 130. A is called “Side1” and B is called “Side2” in this tutorial, but you can name it whatever you want, as long as you remember it!

Written Code
When Game Starts

Create A Clone Of This Object
Set Value “Side1” to “Self Size as a Percentage”/“Sides”
Set Value “Side2” to “Self Size as a Percentage”/“Sides”

When Object Is Cloned

Set Position X (Self X Position) Y ([Original Object Y Position] — [(Height) • 1.9]
Repeat Forever
Set Text To (Area)
End

When Game Starts

Set Sides To [4(Insert How Many Sides Here, In This Case 4)]

When 7 = 7

Set Value (Area) to (Side1) • (Side2)

Picture Of Code

### Perimeter

Perimeter of squares is easy, as long as you know how long each side is. The algorithm for this is (A2 + B2)—For squares and rectangles ONLY, quadrilaterals are way different .

Written Code
When Game Starts

Create A Clone Of This Object
Set Value “Side1” to “Self Size As A Percentage”/“Sides”
Set Value “Side2” to “Self Size As A Percentage”/“Sides”

When Object Is Cloned

Repeat Forever
Set Text To “Perimeter”
End

When 7 = 7

Set Value “Perimeter” to (“Side1” • 2) + (“Side2” • 2)

Picture Code

Simple Way

You just figure out “Side1” and “Side2” values using the “Size Method”
@Hopscotcher said this

16 Likes

Great tutorial! Well documented and well written.

8 Likes

This is perfect, thanks GCC!!

5 Likes

Cherry = Pi is Delicious
Apple = Pi’s R 2

9 Likes

Actual perimeter calculation in real life:
Rectangle/square: Length x Width
Triangle: Base x Height
UwU

4 Likes

That’s area

Perimeter is all four sides added

2 Likes

For perimeter, if you use the Distributive Property, you can make it look like this:

@GameCodingCrazy123

4 Likes