Home » program to find the area of square

program to find the area of square

by Online Tutorials Library

Program to find the area of the square

Area of the square is the amount of space occupied by a square. Square refers to a plane figure with four equal straight sides and four right angles.

Formula

area = width × height  Area of square will be calculated as :   area = side2  since width = height;   

Algorithm

  1. Define the height of any one side of the square as ‘s.’
  2. Calculate the area of the square by multiplying s with s
  3. Define the area_square as the area of the square.

Complexity

O(1)


Solution

C Program

Output:

Area of the square=169      

PHP Program

Output:

Area of the square=169    

Java Program

Output:

Area of the square=169  

C# Program

Output:

Area of the square=169  

Python Program

Output:

Area of the square=169    

Next Topic#

You may also like