What's wrong with my calculator?
I made a calculator for an economics class that is supposed to decide how much to charge a buyer based on how much you want to profit. For some reason, though, GCC is having issues. In the end, the answer (with a 100 profit target, 300 maintenance, 2/cost of a meatie and veggie burger, and demand of 250 for meatie and 250 for veggie) was -0.027938 dollars. Here's the code:
Code:
#include <stdio.h>
#include <math.h>
int main(void) {
/* Variables */
float profit;
float overheadfactories;
float overheadmeatie;
float overheadveggie;
float demandmeatie;
float demandveggie;
float buyercost;
/* Input */
printf("How much of a profit do you want?\n");
scanf("%f",&profit);
//Debugging printf("%f\n",&profit);
printf("How much is your total factory maintenance?\n");
scanf("%f", &overheadfactories);
printf("How much does it cost you to produce a Meatie burger?\n");
scanf("%f", &overheadmeatie);
printf("How much does it cost you to produce a Veggie burger?\n");
scanf("%f", &overheadveggie);
printf("How many Meatie burgers does the buyer want?\n");
scanf("%f", &demandmeatie);
printf("How many Veggie burgers does the buyer want?\n");
scanf("%f", &demandveggie);
/* Math */
buyercost = (overheadfactories + (overheadmeatie * demandmeatie) + (overheadveggie * demandveggie)) + (profit / 0.85);
/* Output */
printf("The buyer should send you %f dollars\n", &buyercost);
}
What's wrong with it?