Notification texts go here Contact Us Click here

Area and Perimeter Calculating in python .

Please wait 0 seconds...
Scroll Down and click on Go to Link for destination
Congrats! Link is Generated

  1. """ Program to calculate area and perimeter of square """

  1.  
  2.  
  3. side= float(input("Enter a side length of the square: "))
  4. area = side ** 2
  5. perimeter = 4 * side
  6. print("Area of the square:",area)
  7. print("Perimeter of the square:", perimeter)
  8.  
  9. OUTPUT :
  10. Enter a side length of the square: 6
  11. Area of the square: 36.0
  12. Perimeter of the square: 24.0
  13.  

 

  1. """ Program to calculate area and perimeter of rectangle """

  1.  
  2.  
  3. length= float(input("Enter length of the rectangle: "))
  4. width= float(input("Enter width of the rectangle: "))
  5. area = length * width
  6. perimeter = 2 * (length + width)
  7. print("Area of the rectangle:",area)
  8. print("Perimeter of the rectangle:",perimeter)
  9.  
  10. OUTPUT ;
  11. Enter length of the rectangle: 12
  12. Enter width of the rectangle: 14
  13. Area of the rectangle: 168.0
  14. Perimeter of the rectangle: 52.0

 

  1.  

  1. """" Program to calculate area and perimeter of circle """

  1. import math
  2. radius = float(input("Enter radius of the circle: "))
  3. area = math.pi * radius ** 2
  4. perimeter = 2 * math.pi * radius
  5. print("Area of the circle:",area)
  6. print("Perimeter of the circle:", perimeter)
  7.  
  8. OUTPUT :
  9. Enter radius of the circle: 5
  10. Area of the circle: 78.53981633974483
  11. Perimeter of the circle: 31.41592653589793
  12.  
  13.  

 

  1. """ Program to calculate area of triangle """

  1.  
  2. base=float(input("Enter base of triangle: "))
  3. height=float(input("Enter height of triangle: "))
  4. area=(base*height)/2
  5. print("Area is =",area)
  6.  
  7. OUTPUT :
  8. Enter base of triangle: 5
  9. Enter height of triangle: 4
  10. Area is = 10.0
  11.  
  12.  

 

  1. """ Program to calculate area of triangle by Heron's formula """

  1.  
  2. import math
  3. = float(input("Enter the first side of the triangle: "))
  4. = float(input("Enter the second side of the triangle: "))
  5. = float(input("Enter the third side of the triangle: "))
  6. = (a + b + c) / 2
  7. area = math.sqrt(s * (s-a) * (s-b) * (s-c))
  8. print("Area of the triangle: ", area)
  9.  
  10. OUTPUT :
  11. Enter the first side of the triangle: 5
  12. Enter the second side of the triangle: 6
  13. Enter the third side of the triangle: 8
  14. Area of the triangle:  14.981238266578634

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.