/* Gregory Fala */ /* pianoman128@yahoo.com */ /* Program to Calculate the Price Per Square Inch for Pizza from a Restaurant */ #include int main () { /* Define constants and variables */ const double pi = 3.1415; double pizzaPrice; double pizzaDiameter; double pizzaRadius; double pizzaArea; double pizzaSqInPrice; /* Greet user */ printf ("Welcome to the Consumer Value Pizza Calculator. \n"); printf (" Enjoy! \n"); printf (" \n "); /* Get price of pizza from user */ printf ("Please enter the price of the pizza: "); scanf ("%lf", &pizzaPrice); printf (" \n "); /* Get diameter of pizza (in inches) from user */ printf ("Please enter the diameter of the pizza (in inches): "); scanf ("%lf", &pizzaDiameter); printf (" \n "); /* Determine radius of pizza */ pizzaRadius = pizzaDiameter / 2; /* Determine area of pizza */ pizzaArea = pi * pizzaRadius * pizzaRadius; /* Determine price per square inch of pizza */ pizzaSqInPrice = pizzaPrice/pizzaArea; /* Display results */ printf ("Results: \n "); printf (" \t Diameter: %4.0f Radius: %6.2f Area: %7.2f Price: %6.2f \n", pizzaDiameter, pizzaRadius, pizzaArea, pizzaPrice); printf (" \n "); printf ("The Cost Per Square Inch Is: %6.3f \n", pizzaSqInPrice); return 0; }