Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 1.48 KB

File metadata and controls

30 lines (20 loc) · 1.48 KB

Square Pyramid Calculator

Overview

The Square Pyramid Calculator is a Python program designed to calculate the surface area and volume of a square pyramid. This tool is especially useful for solving problems involving square pyramids where the height and the base length are known.

Purpose

The purpose of this program is to find the surface area and volume of a square pyramid using the provided height and base length. The formulas used in the calculations are:

  • Volume: [ \text{volume} = \frac{a^2 \times h}{3} ]
  • Slant Height: [ \text{slant height} = \sqrt{h^2 + \left(\frac{a}{2}\right)^2} ]
  • Area of one pyramid side: [ \text{area one side} = \frac{\text{slant height} \times a}{2} ]
  • Surface Area of the four sides: [ \text{surface area} = 4 \times \text{area one side} ]

How to Use the Program

  1. Input the Height of the Pyramid:
    When prompted, enter the height of the pyramid.

  2. Input the Length of the Base:
    When prompted, enter the length of the base of the pyramid.

  3. View the Results:
    The program will calculate and display the volume and surface area of the pyramid.

Code Explanation

The program begins by displaying a welcome message and instructions. It then prompts the user to input the height and the base length of the pyramid. Using these inputs, it calculates the volume and surface area of the square pyramid. The results are then displayed.

Dependencies

This program requires Python 3 and the math module to run.