📜  程序寻找广场面积

📅  最后修改于: 2021-04-29 14:47:13             🧑  作者: Mango

什么是正方形?
正方形是在一个平面上的平面形状,由四个角的四个点定义。一个正方形具有四个等长的边和四个直角(90度角)的角。正方形是一种矩形,但边长相等。

公式 :
Area = side * side
例子:

Input : 4
Output :16

Input :8
Output :64
CPP
// CPP program to find the area of a square
#include 
using namespace std;
 
// function to find the area
int area_fun(int side)
{
int area = side * side;
return area;
}
 
// Driver program
int main()
{
int side = 4;
int area = area_fun(side);
cout << area;
return 0;
}


Java
// Java program to find
// the area of a square
 
class GFG
{
 
// function to find the area
static int area_fun(int side)
{
int area = side * side;
return area;
}
 
// Driver code
public static void main(String arg[])
{
    int side = 4;
    int area = area_fun(side);
    System.out.println(area);
}
}
 
// This code is contributed
// by Anant Agarwal.


Python3
# Python program to find
# the area of a square
 
# function to find the area
def area_fun(side):
    area = side * side
    return area
 
# Driver program
side = 4
area = area_fun(side)
print (area)
 
# This Code is Contributed
# by Azkia Anam.


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


PHP


Javascript


输出:

16