A square is a flat shape, in one plane, defined by four points at the four corners. A square has four sides all of equal length, and four corners, all right angles (90 degree angles). A square is a kind of rectangle.

**Examples :**

Input : 4 Output :16 Input :8 Output :64

**Formula**

## C++

`// CPP program to find ` `// the area of the square ` `#include <iostream> ` `using` `namespace` `std; ` ` ` `int` `areaSquare(` `int` `side) ` `{ ` ` ` `int` `area = side * side; ` ` ` `return` `area; ` `} ` ` ` `// Driver Code ` `int` `main() ` `{ ` ` ` `int` `side = 4; ` ` ` `cout << areaSquare(side); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find ` `// the area of the square ` `import` `java.util.*; ` ` ` `class` `GFG ` `{ ` ` ` `static` `int` `areaSquare(` `int` `side) ` ` ` `{ ` ` ` `int` `area = side * side; ` ` ` `return` `area; ` ` ` `} ` ` ` ` ` `// Driver Code ` ` ` `public` `static` `void` `main(String[] args) ` ` ` `{ ` ` ` `int` `side = ` `5` `; ` ` ` `System.out.println(areaSquare(` `4` `)); ` ` ` `} ` `} ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 code to find ` `# the area of the square ` ` ` `def` `areaSquare( side ): ` ` ` `area ` `=` `side ` `*` `side ` ` ` `return` `area ` ` ` `# Driver Code ` `side ` `=` `4` `print` `(areaSquare(side)) ` ` ` `# This code is contributed ` `# by "Sharad_Bhardwaj". ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find ` `// the area of the square ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `static` `int` `areaSquare(` `int` `side) ` ` ` `{ ` ` ` `int` `area = side * side; ` ` ` `return` `area; ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `Main() ` ` ` `{ ` ` ` `int` `side = 4; ` ` ` ` ` `Console.WriteLine(areaSquare(side)); ` ` ` `} ` `} ` ` ` `// This code is contributed by vt_m ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find ` `// the aria of the square ` ` ` `function` `areaSquare(` `$side` `) ` `{ ` ` ` `$area` `= ` `$side` `* ` `$side` `; ` ` ` `return` `$area` `; ` `} ` ` ` `// Driver Code ` `$side` `= 4; ` `echo` `(areaSquare(` `$side` `)); ` ` ` `// This code is contributed by Ajit. ` `?> ` |

*chevron_right*

*filter_none*

**Output :**

16

This article is contributed by **Ajay Puri**. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above..

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Program to find the area of a Square
- Program to calculate area of an Circle inscribed in a Square
- Program to find the surface area of the square pyramid
- Program for Area Of Square after N-th fold
- Program to print Square inside a Square
- Calculate Volume, Curved Surface Area and Total Surface Area Of Cylinder
- Find area of the larger circle when radius of the smaller circle and difference in the area is given
- Area of a square from diagonal length
- Area of a Circumscribed Circle of a Square
- Area of square Circumscribed by Circle
- Area of a largest square fit in a right angle triangle
- Area of the Largest square that can be inscribed in an ellipse
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle
- Area of a leaf inside a square
- Find the area of the shaded region formed by the intersection of four semicircles in a square
- Area of the circle that has a square and a circle inscribed in it
- Area of largest semicircle that can be drawn inside a square
- Minimum area of square holding two identical rectangles
- Find side of Square which makes minimal area to fit two identical rectangles inside it
- Area of a Square | Using Side, Diagonal and Perimeter