0
    print "enter a number: ";
        $in = <>;
        chomp $in;
        print &prime($in);
        print "\n";

        sub prime{
        for($i=2;$i<($_[0]/2+1);$i++){
        if($_[0]%$i ==0){return "not prime\n"}
        }
        return "prime\n";
        }

can anyonet tell me, what program do i use to make this code work?..
i just found it on the internet while searching a formula for evaluating if a number is prime or composite..
i didn't see any program they tell to use this code..

Edited by pritaeas: Moved.

4
Contributors
5
Replies
7
Views
5 Years
Discussion Span
Last Post by gourav_rao
0

well, it's not Java, I'll tell you that much.
never just "copy code". in this case, you don't even know what language it is, so, how do you know it 'll work?

0

looks like Perl to me, but then I'm again, it's been years since I worked with Perl, and there are tons of scripting languages I've never worked with, so ...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.