Advertisement
Toma252

4.2 recktangle 1

Oct 16th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. #This program calculates circumference and area of rectangle#
  2. #############################################################
  3.  
  4. # Circumference of a rectangle
  5. def rectangle_circumference(length, width):
  6.     circumference = 2 * a + 2 * b
  7.     return circumference
  8.  
  9. # Area of a rectangle
  10. def rectangle_area(length, width):
  11.     area = a * b
  12.     return area
  13.  
  14. # Length and width of a square
  15.  
  16. a = float(input("Please enter length of a recktangle: "))
  17. b = float(input("Please enter width of a rectangle: "))
  18. C = rectangle_circumference(a,b)
  19. A = rectangle_area(a,b)
  20.  
  21. # Print the result
  22. print("\n")
  23. print("The circumference and area of a recktangle are %f and %f, respectively." % (C,A))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement