Quiz: Calculate your weight in platinum using float type value - C Language Basics

C examples for Language Basics:printf

Description

Quiz: Calculate your weight in platinum using float type value

Demo Code

#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;
}

Result


Related Tutorials