Advertisement
everblut

Numeros Primos

Mar 8th, 2011
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.28 KB | None | 0 0
  1. #! usr/bin/perl
  2.  
  3. print ' Inserta el numero que quieras comprobar si es primo ';
  4. my $num = <STDIN>;
  5. chop($num);
  6. for($i=2;$i < $num; $i++)
  7. {
  8.   if($num % $i == 0)
  9.   {
  10.     print '$num No es primo \n';
  11.     last
  12.   }
  13.   else
  14.   {
  15.     print '$num es primo \n';
  16.     last
  17.   }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement