76
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
- Define the height of any one side of the square as ‘s.’
- Calculate the area of the square by multiplying s with s
- 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#