home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / dos / prg / sphinx / examples / other / sqrt.c__ < prev   
Encoding:
Text File  |  1993-04-30  |  647 b   |  27 lines

  1. /*
  2.    NAME:  SQRT.C--
  3.    DESCRIPTION:  Small test program for SQRT(/*wordvalue*/) that displays
  4.                  all of the complete squares by running through all the
  5.                  values from 1 to 65535.
  6. */
  7.  
  8. ?include "MATH.H--"      /* SQRT defined in this file */
  9. ?include "WRITE.H--"     /* procedure to write to screen */
  10.  
  11. ?define count SI   // use SI as the word count value 
  12.  
  13. main ()
  14. word root;
  15. {
  16. count=1;
  17. do {root = SQRT(count);
  18.     IF( root*root == count )
  19.         {WRITEWORD(count);
  20.         WRITE('|');
  21.         WRITEWORD(root);
  22.         WRITE(' ');}
  23.     count++;
  24.     } while( count );
  25. }
  26.  
  27. /* end of SQRT.C-- */