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++
#include <iostream>
using namespace std;
int areaSquare( int side)
{
int area = side * side;
return area;
}
int main()
{
int side = 4;
cout << areaSquare(side);
return 0;
}
|
Java
import java.util.*;
class GFG
{
static int areaSquare( int side)
{
int area = side * side;
return area;
}
public static void main(String[] args)
{
int side = 5 ;
System.out.println(areaSquare( 4 ));
}
}
|
Python3
def areaSquare( side ):
area = side * side
return area
side = 4
print (areaSquare(side))
|
C#
using System;
class GFG
{
static int areaSquare( int side)
{
int area = side * side;
return area;
}
public static void Main()
{
int side = 4;
Console.WriteLine(areaSquare(side));
}
}
|
PHP
<?php
function areaSquare( $side )
{
$area = $side * $side ;
return $area ;
}
$side = 4;
echo (areaSquare( $side ));
?>
|
Javascript
<script>
function areaSquare(side)
{
let area = side * side;
return area;
}
let side = 4;
document.write(areaSquare(side));
</script>
|
Output :
16
Time complexity : O(1)
Auxiliary Space : O(1)
If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@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..
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!