In: Computer Science
I'm having trouble with this program
here's the problem:
A milk carton can hold 3.78 liters of milk.
Each morning, a dairy farm ships cartons of milk to a local grocery
store.
The cost of producing one liter of milk is $0.38, and the profit of each carton of milk is $0.27.
Write a program that does the following:
Here's the program:
#include <stdio.h>
int main(void){
const float cartoncapacity=3.78;
const float costperliter=0.38;
float profitpercarton=0.27;
float milkproduced, milkcost;
int cartonsneeded;
double profit;
printf("Enter, liters, the total quantity of milk produced:\n");
scanf("%f", &milkproduced);
cartonsneeded=((milkproduced+3.78)/cartoncapacity);
printf("Total number of cartons needed to hold:\n");
scanf("%d",&cartonsneeded);
milkcost=costperliter*milkproduced;
profit=profitpercarton*cartonsneeded;
printf("The cost of producing milk $ %f", &milkcost);
printf("Profit: $ %lf",&profit);
return (0);
}
#include <stdio.h>
int main(void){
const float cartoncapacity=3.78;
const float costperliter=0.38;
float profitpercarton=0.27;
float milkproduced, milkcost;
int cartonsneeded;
double profit;
printf("Enter, liters, the total quantity of milk produced:
");
scanf("%f", &milkproduced);
printf("Total number of cartons needed to hold:
");
scanf("%d",&cartonsneeded);
milkcost=costperliter*milkproduced;
profit=profitpercarton*cartonsneeded;
printf("The cost of producing milk $ %f
", milkcost);
printf("Profit: $ %lf",profit);
return (0);
}


