[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] What's wrong?



Dakota


#!/usr/local/bin/perl

# PrimePick
# by Dakota Duff
# Looks for, and prints, prime numbers
# Copyright December 1, 1997

# This program may be distributed and edited freely,
# but please leave the above comments attached.

$Begin = 1;
$stop = &MacPerl'Ask("Stop searching at:", "100");
$End = int($stop);
@intgrs = (1 .. "$End");


while ($Begin < $End)  {
  $div = 2;
  $num = $Begin;
  $status = 0;
  while ($div < $End)  {
    $ans = $num/$div;
    if ($ans == @intgrs)  {
      $status = 1;
    }
    $num++;
  }
  if ($status == 0)  {
    print $num;
  }
  $Begin++;
}

print "...DONE...";



Attachment converted: /:primepick.pl (TEXT/MSIE) (01000290)