Program for Area Of Square
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.

Attention reader! All those who say programming isn't for kids, just haven't met the right mentors yet. Join the Demo Class for First Step to Coding Course, specifically designed for students of class 8 to 12.
The students will get to learn more about the world of programming in these free classes which will definitely help them in making a wise career choice in the future.
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 Codeint main(){ int side = 4; cout << areaSquare(side); return 0;} |
Java
// Java program to find// the area of the squareimport 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)); }} |
Python3
# Python3 code to find# the area of the squaredef areaSquare( side ): area = side * side return area# Driver Codeside = 4print(areaSquare(side))# This code is contributed# by "Sharad_Bhardwaj". |
C#
// C# program to find// the area of the squareusing 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 |
PHP
<?php// PHP program to find// the aria of the squarefunction areaSquare($side){ $area = $side * $side; return $area;}// Driver Code$side = 4;echo(areaSquare($side));// This code is contributed by Ajit.?> |
Javascript
<script>// Javascript program to find// the area of the squarefunction areaSquare(side){ let area = side * side; return area;}// Driver Code let side = 4; document.write(areaSquare(side));// This code is contributed by Mayank Tyagi</script> |
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..


