platinum.c 769 B

12345678910111213141516171819202122
  1. /* platinum.c -- your weight in platinum */
  2. #include <stdio.h>
  3. int main(void)
  4. {
  5. float weight; /* user weight */
  6. float value; /* platinum equivalent */
  7. printf("Are you worth your weight in platinum?\n");
  8. printf("Let's check it out.\n");
  9. printf("Please enter your weight in pounds: ");
  10. /* get input from the user */
  11. scanf("%f", &weight);
  12. /* assume platinum is $1700 per ounce */
  13. /* 14.5833 converts pounds avd. to ounces troy */
  14. value = 1700.0 * weight * 14.5833;
  15. printf("Your weight in platinum is worth $%.2f.\n", value);
  16. printf("You are easily worth that! If platinum prices drop,\n");
  17. printf("eat more to maintain your value.\n");
  18. return 0;
  19. }