Turn a character digit into a number

Read one non-whitespace character representing a single decimal digit. If it is not in '0'..'9', print invalid. Otherwise interpret it as a quantity, charge 125 cents per item, and print quantity=Q price=D.CC with exactly two digits after the decimal point. For example, character '3' must produce quantity=3 price=3.75. Only the first non-whitespace character is part of this task.

    Use integer arithmetic for money. Explain why assigning digit directly to an int does not in general produce the intended quantity, why subtraction of '0' works in C, and why you must not hard-code the numeric value 48.


