Unformatted text preview: this * example. Using 10.5 percent did show the problem. */ #include <stdio.h> int main() { float x; /* Currency calculation */ x=59.00+(10.5/100.)*59.00; printf("59.00 + 10.5 percent of 59.00 = %.10f\n", x); printf("The exact answer should be = 65.195\n"); printf("\n"); printf("Consider the effect of rounding to the nearest cent.\n"); /* I get the result 65.1949996948 which would be rounded to $65.19; * however the (exact) answer is 65.195 which would be rounded to * $65.20  a ripoff of one cent! */ return 0; }...
View
Full
Document
This note was uploaded on 09/29/2009 for the course COSC 1002 taught by Professor Wheatland during the Three '09 term at University of Sydney.
 Three '09
 wheatland

Click to edit the document details