Question

In: Computer Science

Write a program that calculates the cost per square inch of a circular pizza, given its...

Write a program that calculates the cost per square inch of a circular pizza, given its diameter and price. The formula for area of a circle is

Solutions

Expert Solution

code:

#include<math.h>
#include <stdio.h>

int main()
{
float diameter,area,radius,cost,price;
printf("Enter the diameter of pizza: ");
scanf("%f",&diameter);
printf("Enter the price of pizza: ");
scanf("%f",&price);
radius=diameter/2;
area=(22/7*radius*radius);
cost=price/area;
printf("cost per inch is :%.2f",cost);
return 0;
}

If you code in any langauge (python,c++,java) comment me i will edit my answer.


Related Solutions

Write a program that calculates the mean, median and mode of a given array in the...
Write a program that calculates the mean, median and mode of a given array in the following manner: i) Write three functions mean (), median () and mode () that calculates the mean, median and mode of an array. ii) Using these functions write a program that calculates all the three above mentioned values for two different arrays A and B where A is an array that contains the number of hours spent by a person each day for playing...
Create a program in java that calculates area and perimeter of a square - use a...
Create a program in java that calculates area and perimeter of a square - use a class and test program to calculate the area and perimeter; assume length of square is 7 ft.
Write a Java Program to place a pizza ordering program. It creates a pizza ordered to...
Write a Java Program to place a pizza ordering program. It creates a pizza ordered to the specifications that the user desires. It walks the user through ordering, giving the user choices, which the program then uses to decide how to make the pizza and how much the cost of the pizza will be. Note: Use dialog boxes for communicating with the user. Remember to use the JOptionPane class which is the graphical user interface (GUI) and Comments that are...
Write a Java Program to place a pizza ordering program. It creates a pizza ordered to...
Write a Java Program to place a pizza ordering program. It creates a pizza ordered to the specifications that the user desires. It walks the user through ordering, giving the user choices, which the program then uses to decide how to make the pizza and how much the cost of the pizza will be. Note: Use dialog boxes for communicating with the user. Remember to use the JOptionPane class which is the graphical user interface (GUI) and Comments that are...
Please use Phyton to write a program: Write a program that calculates and displays the total...
Please use Phyton to write a program: Write a program that calculates and displays the total bill at a restaurant for a couple that is dining. The program should collect from the couple, cost of each meal, and the percentage of the final cost that they would like to tip. The sales tax in the state where the restaurant exists is 7.5%. Display to the user, line by line: Total Cost of Both Meals Sales Tax in dollars Tip in...
Write a program that calculates the balance of a savings account at the end of a...
Write a program that calculates the balance of a savings account at the end of a three month period. It should ask the user for the starting balance and the annual interest rate. A loop should then iterate once for every month in the period, performing the following: Ask the user for the total amount deposited into the account during that month. Do not accept negative numbers. This amount should be added to the balance. Ask the user for the...
Write a program that calculates the balance of a savings account at the end of a...
Write a program that calculates the balance of a savings account at the end of a period of time. It should ask the user for the annual interest rate, the starting balance, and the number of months that have passed since the account was established. A loop should then iterate once for every month, performing the following: Ask the user for the amount deposited into the account during the month. (Do not accept negative numbers.) This amount should be added...
  A concrete mix is designed to withstand 3000 pounds per square inch​ (psi) of pressure. The...
  A concrete mix is designed to withstand 3000 pounds per square inch​ (psi) of pressure. The following data represent the strength of nine randomly selected casts​ (in psi). ​3970 4090 3000 2950 3840 4090 4040 3490 Compute the​ mean, median and mode strength of the concrete​ (in psi).
A concrete mix is designed to withstand 3000 pounds per square inch​ (psi) of pressure. The...
A concrete mix is designed to withstand 3000 pounds per square inch​ (psi) of pressure. The following data represent the strength of nine randomly selected casts​ (in psi). 3960​, 4090​, 3200​, 3000​, 2950​, 3830​, 4090​, 4040​, 3780    Compute the​ mean, median and mode strength of the concrete​ (in psi). Compute the mean strength of the concrete. Select the correct choice below​ and, if​ necessary, fill in the answer box to complete your choice. A.The mean strength of the concrete...
Program Name: Divisible. Write a program that calculates the number of integers in a range from...
Program Name: Divisible. Write a program that calculates the number of integers in a range from 1 to some user-specified upper bound that are divisible by 3, the sum of those integers, and the number and sum of those integers not divisible by 3. Your program must display meaningful output which includes: the selected upper bound number of integers divisible by 3 sum of integers divisible by 3 number of integers not divisible by 3 sum of integers not divisible...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT