/* PROGRAM 16-1
   Illustrates various printf formats
*/
 
main( )
{
 char             c = 'X';
 static char      s[] = "abcdefghijklmnopqrstuvwxyz";
 int              i = 425;
 short int        j = 17;
 unsigned int     u = 0xf179;
 long int         l = 75000L;
 float            f = 12.978;
 double           d = -97.4583;
 
 printf("\nIntegers:\n\n");
 printf("%d  %o  %x  %u\n", i, i, i, i);
 printf("%d  %o  %x  %u\n", j, j, j, j);
 printf("%d  %o  %x  %u\n", u, u, u, u);
 printf("%ld  %lo  %lx  %lu\n", l, l, l, l);
 
 printf("\nFloats and Doubles:\n\n");
 printf("%f  %e  %g\n", f, f, f);
 printf("%.2f  %.2e\n", f, f);
 printf("%.0f  %.0e\n", f, f);
 printf("%07.2f  %07.2e\n", f, f);
 printf("%f  %e  %g\n", d, d, d);
 printf("%.*f\n", 3, d);
 printf("%0*.*f\n", 8, 2, d);
 
 printf("\nCharacters:\n\n");
 printf("%c\n", c);
 printf("%3c%3c\n", c, c);
 printf("%-3c%-3c\n", c, c);
 
 printf("\nStrings:\n\n");
 printf("%s\n", s);
 printf("%.5s\n", s);
 printf("%30s\n", s);
 printf("%20.5s\n", s);
 printf("%-20.5s|\n", s);
}
 
/* Program 16-1 Output  
 
Integers:
 
425  651  1a9  425
17  21  11  17
61817  170571  f179  61817
75000  222370  124f8  75000
 
Floats and Doubles:
 
12.978000  1.297800e+01  12.978
12.98  1.30e+01
13  1.e+01
0012.98  1.30e+01
-97.458300  -9.745830e+01  -97.4583
-97.458
-0097.46
 
Characters:
 
X
  X  X
X  X
 
Strings:
 
abcdefghijklmnopqrstuvwxyz
abcde
    abcdefghijklmnopqrstuvwxyz
               abcde
abcde               |
*/
