/* Problem 4--Making Money A very easy problem. The only sticky point was avoiding round-off error. */ #include #include #include int main (int argc, char **argv); int main (int argc, char **argv) { int cents, cs, t, C; FILE *in, *out; double P, I, tc; in = fopen ("prob4.in","r"); out = fopen ("prob4.out","w"); for (cs=1;fscanf (in,"%lf %lf %d",&P,&I,&C),P>0 || I>0 || C>0;cs++) { cents = (int)(P*100+0.5); /* We will work in integers to prevent */ for (t=0;t