Computer Science, asked by chitragchitra4790, 11 months ago

Write a python programming to take out area and perimeter of a feild in meter and meter square

Answers

Answered by Anonymous
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")

\rule{200}{2}

============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

\rule{200}{2}

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 AbhijithPrakash
11
  1. ## As the question is simple let's add some functions.
  2. ## I'll define two functions each for the area and the perimeter.
  3. ## We define a function using def keyword.
  4. def area():  
  5.    A=length*breadth ## This is the formula for the area.
  6.    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.
  7. def perimeter():
  8.    P=2*(length + breadth) ## This is the formula for the perimeter.
  9.    print(("\n The perimeter of your field is {} m.".format(P))) ## This will print the perimeter of the field in meters.
  10. # Driver code
  11. length = int(input("Enter the length of the field(in meters) : "))  ## This will ask the user the length of the field.
  12. breadth = int(input("Enter the breadth of the field(in meters) : ")) ## This will ask the user the breadth of the field.
  13. ## Calling the functions
  14. area()
  15. perimeter()
Attachments:
Similar questions