Solution for Exercise 5-5
ex0505
#include <stdio.h> int main() { printf("The result is %f\n",456.98+213.4); return(0); }
Notes
* The text you supplied for printf() doesn't need to match mine above, but using the %f
placeholder is important; both values are floating point, so the result is a float. The %f
placeholder must be specified.
* Did you remember to limit the floating point number's output to only two decimal places? If not, fix your code and build again.
* Modify the code so that the output looks like this:
Edit the printf() statement to achieve that result. Use placeholders instead of immediate values in the formatting string. Click here to see my solution.
Copyright © 1997-2024 by QPBC.
All rights reserved