postage.c 379 B

123456789101112131415
  1. // postage.c -- first-class postage rates
  2. #include <stdio.h>
  3. int main(void)
  4. {
  5. const int FIRST_OZ = 46; // 2013 rate
  6. const int NEXT_OZ = 20; // 2013 rate
  7. int ounces, cost;
  8. printf(" ounces cost\n");
  9. for (ounces=1, cost=FIRST_OZ; ounces <= 16; ounces++,
  10. cost += NEXT_OZ)
  11. printf("%5d $%4.2f\n", ounces, cost/100.0);
  12. return 0;
  13. }