home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc_prog / chap04 / table.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-04-05  |  566 b   |  23 lines

  1.  
  2. /* TABLE.C -- prints square root, square, and cube */
  3. /*            for the numbers 1 thru 9             */
  4.  
  5. #include <math.h> /* include math functions so we  */
  6.                   /*  can do square root           */
  7.  
  8. main()
  9. {
  10.     int i;
  11.     printf("i\t sqrt(i)\tsquare(i)\tcube(i)\n\n");
  12.     for (i = 1; i < 10; i++)
  13.         /* beginning of body of loop */
  14.         {
  15.         printf("%d\t", i);
  16.         printf("%f\t", sqrt(i));
  17.         printf("%d\t\t", i * i);
  18.         printf("%d\n", i * i * i);
  19.         }
  20.         /* end of body of loop */
  21. }
  22.  
  23.