Solution for Exercise 6-3
ex0603
#include <stdio.h> int main() { char c; int i; float f; double d; c = 'a'; i = 1; f = 19.0; d = 20000.009; printf("%c\n%d\n%f\n%f\n",c,i,f,d); return(0); }
Output
a
1
19.000000
20000.009000
Notes
* The combination of conversion characters and the \n
escape sequence in the printf() statement makes it appear far more complex than it really is.
* I would typically not use such a complex printf() statement in my code. While it works, it's just not readable enough to know what's going on. Generally in such a situation, I would break the single statement up into multiple statements, as was done in Exercise 6-2.
Copyright © 1997-2024 by QPBC.
All rights reserved