home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume11 / musbus / part01 / arith.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-09-16  |  512 b   |  44 lines

  1.  
  2. /*
  3.  *  arithmetic test
  4.  *
  5.  * $Header: arith.c,v 3.5 87/08/06 08:11:18 kenj Exp $
  6.  */
  7.  
  8. main(argc, argv)
  9. int    argc;
  10. char    *argv[];
  11. {
  12.     int    iter;
  13.     int    i;
  14. #ifndef arithoh
  15.     datum    x, y, z;
  16. #endif
  17.  
  18.     if (argc != 2) {
  19.         printf("Usage: %s count\n", argv[0]);
  20.         exit(1);
  21.     }
  22.  
  23.     iter = atoi(argv[1]);
  24.  
  25.     while (iter-- > 0) {
  26. #ifndef arithoh
  27.         z = 0;
  28. #endif
  29.         /*
  30.          *     101
  31.          * sum       i*i/(i*i-1)
  32.          *     i=2
  33.          */
  34.         for (i=2; i<=101; i++) {
  35. #ifndef arithoh
  36.             x = i;
  37.             y = x*x;
  38.             z += y/(y-1);
  39. #endif
  40.         }
  41.     }
  42.     exit(0);
  43. }
  44.