home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ctutor2.zip / ANSWERS / CH04_2.C < prev    next >
Text File  |  1989-11-10  |  434b  |  30 lines

  1. main()
  2. {
  3. int index;
  4. float inversion;
  5.  
  6.    for(index = 1;index < 13; index = index + 1) {
  7.       inversion = 1.0/index;
  8.       printf("%5d%9.5f\n",index, inversion);
  9.    }
  10. }
  11.  
  12.  
  13.  
  14. /* Result of execution
  15.  
  16.     1    1.00000
  17.     2     .50000
  18.     3     .33333
  19.     4     .25000
  20.     5     .20000
  21.     6     .16667
  22.     7     .14286
  23.     8     .12500
  24.     9     .11111
  25.    10     .10000
  26.    11     .09091
  27.    12     .08333
  28.  
  29. */
  30.