Python program to calculate square area and circumference

Views: 118   

Following program shows you how to calculate square area and circumference.
This program gets square length from user and calculates area and circumference and prints them using following formulas
Area = length X length
Circumference = 4 X length

squareLength = float(input("Enter length of square:"))
areaOfSquare = squareLength * squareLength
print("Area of square is: ", areaOfSquare)
circumferenceOfSquare = 4 * squareLength
print("Circumference of square is: ", circumferenceOfSquare)

Output:

Enter length of square: 7
Area of square is:  49.0
Circumference of square is:  28.0
On By