Write a python programming to take out area and perimeter of a feild in meter and meter square
Answers
Answered by
7
AnsweR :
===========Coding==============
- For Area of Square field
Side = int(input("Enter Side of field"))
Area = Side**2
print("Area of Square field is : ", Area, "m^2")
_______________________
- For perimeter of square filed
Side = int(input("Enter Side of Square field"))
Perimeter = 4*Side
print("Perimeter of Square field is :", Perimeter, "m")
============OutPut=============
Output 1)
Enter Side of field 20
Area of Square field is 400 m^2
_______________________
Output 2)
Enter Side of Square field 20
Perimeter of Square field is 80 m
Field can be Rectangular as well :
==========Coding===========
Length = int(input("Enter Length of feild"))
Breadth = int(input("Enter Breadth of field"))
Area = Length*Breadth
Perimeter = 2*(Length + Breadth)
print("Area of field is ", Area, "m^2")
print("Perimeter of field is ", Perimeter, "m")
Answered by
11
- ## As the question is simple let's add some functions.
- ## I'll define two functions each for the area and the perimeter.
- ## We define a function using def keyword.
- def area():
- A=length*breadth ## This is the formula for the area.
- print("\n The area of your field is {} m\N{SUPERSCRIPT TWO}.".format(A)) ## This will print the area of the field in meters square.
- def perimeter():
- P=2*(length + breadth) ## This is the formula for the perimeter.
- print(("\n The perimeter of your field is {} m.".format(P))) ## This will print the perimeter of the field in meters.
- # Driver code
- length = int(input("Enter the length of the field(in meters) : ")) ## This will ask the user the length of the field.
- breadth = int(input("Enter the breadth of the field(in meters) : ")) ## This will ask the user the breadth of the field.
- ## Calling the functions
- area()
- perimeter()
Attachments:
Similar questions
Computer Science,
5 months ago
Math,
5 months ago
English,
5 months ago
CBSE BOARD X,
11 months ago
Social Sciences,
11 months ago