Well, ok. Guess i can help a little. Here goes:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char *argv[])
{
int day, night, weekend;
double planA, planB;
printf ("Number of daytime minutes?\n");
scanf("%d", &day);
printf ("Number of evening minutes?\n");
scanf("%d", &night);
printf ("Number of weekend minutes?\n");
scanf("%d", &weekend);
if (day > 100)
planA = (day - 100)*0.25 + night*0.15 + 0.2*weekend;
else
planA = night*0.15 + 0.2*weekend;
if (day > 250)
planB = (day - 250)*0.45 + night*0.35 + 0.25*weekend;
else
planB = night*0.35 + 0.25*weekend;
printf ("Plan A costs %0.2f\n", planA);
printf ("Plan B costs %0.2f\n", planB);
/* abs needed because turing stores reals with a potential small error */
if (abs (planA - planB) < 0.00005)
printf("Plan A and B are the same price.\n");
else if (planA > planB)
printf("Plan B is the cheapest.\n");
else
printf("Plan A is the cheapest.\n");
system("PAUSE");
return 0;
}
There! Happy?