C examples for Language Basics:printf
Quiz: Calculate your weight in platinum using float type value
#include <stdio.h> int main(void) { float weight; float value; /* platinum equivalent */ /*from ww w . j av a2s . co m*/ printf("Please enter your weight in pounds: "); /* get input from the user */ scanf("%f", &weight); value = 1700.0 * weight * 14.5833; printf("Your weight in platinum is worth $%.2f.\n", value); return 0; }