-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplatinum.c
More file actions
22 lines (19 loc) · 724 Bytes
/
platinum.c
File metadata and controls
22 lines (19 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* platinum.c -- your weight in platinum */
#include <stdio.h>
int main(void)
{
float weight; /* user weight */
float value; /* platinum equivalent */
printf("Are you worth your weight in platinum?\n");
printf("Let's check it out.\n");
printf("Please enter your weight in pounds: ");
/* get input from the user */
scanf("%f", &weight);
/* assume platinum is $1700 per ounce */
/* 14.5833 converts pounds avd. to ounce troy */
value = 1700.0 * weight * 14.5833;
printf("Your weight in platinum is worth $%.2f.\n", value);
printf("You are easily worth that! If platinum prices drop, \n");
printf("eat more to maintain your value.\n");
return 0;
}