in reply to Re: Prime Number Finder
in thread Prime Number Finder
this is the actual code that works on windows and generates prime numbers upto the number you wish, check below code:
#!usr/bin/perl -w
use strict;
use warnings;
my $o = 2;
print "enter upto what no.you wish generate the primes: ";
my $e = <STDIN>;
my ($i,$j,$p);
my @prime_=();
print "prime numbers are:\n";
for($i=$o; $i<=$e; $i++){
$p=0;
for($j=1; $j<=$i; $j++){
if($i % $j== 0){
$prime_$p = "$j";
$p++;
}
if ($prime_1 == $i)
{
print "$i\t";
}
}
}
print"\n";
In Section
Cool Uses for Perl