Final answer:
The cost per square inch of a circular pizza is calculated by dividing the total cost of the pizza by its area. The area is computed using the circle area formula πr^2, with the radius being half of the pizza's diameter.
Step-by-step explanation:
To calculate the cost per square inch of a circular pizza, you need to know the total cost of the pizza and its diameter. First, calculate the radius by dividing the diameter by 2. Then, use the formula for the area of a circle, which is π
here π is Pi, approximately 3.14159, and r is the radius), to get the pizza's total area in square inches. Finally, divide the total cost of the pizza by the area to get the cost per square inch.
Python Program Example;
import math
def calculate_cost_per_sq_inch(diameter, total_cost):
radius = diameter / 2
area = math.pi * (radius ** 2)
cost_per_sq_inch = total_cost / area
return cost_per_sq_inch
diameter = float(input('Enter the diameter of the pizza in inches: '))
total_cost = float(input('Enter the total cost of the pizza in dollars: '))
price_per_inch = calculate_cost_per_sq_inch(diameter, total_cost)
print(f'The cost per square inch of the pizza is: ${price_per_inch:.2f}')