home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 98.img / LCNOW2.ZIP / EXAMPLES / PWRTBL2.C < prev    next >
C/C++ Source or Header  |  1988-06-25  |  407b  |  30 lines

  1. /*
  2.  * P W R T B L 2
  3.  *
  4.  * Print a table of powers.
  5.  */
  6.  
  7. #include "macros.h"
  8.  
  9. #define MAXN 10
  10.  
  11. main()
  12. {
  13.     int n;
  14.  
  15.     /*
  16.      * Label the columns.
  17.      */
  18.     puts("number\t exp2\t exp3\t exp4");
  19.     puts("------\t-----\t-----\t-----");
  20.  
  21.     /*
  22.      * Print the table of power values.
  23.      */
  24.     for (n = 0; n <= MAXN; ++n)
  25.         printf("%2d\t%5d\t%5d\t%5d\n",
  26.             n, SQR(n), CUBE(n), QUAD(n));
  27.  
  28.     return (0);
  29. }
  30.