5 comments:

  1. $num1=$_POST["num"];
    $flag=0;
    for($i=2;$i<=$num1/2;$i++)
    {
    if($num1%$i==0)
    {
    $flag=1;
    break;
    }
    }
    if($flag==1)
    {
    echo "Number is not prime";
    }
    else
    echo "Prime";

    ReplyDelete
  2. php
    $low=$_POST['num'];
    $flag=0;
    for($i=2;$i<$low;$i++)
    { if($low%$i==0)
    {$flag=1;
    break;
    }
    }
    if($flag==0)
    echo"
    $low is an prime number";
    else
    echo"
    $low is not a prime number";
    ?>

    ReplyDelete
  3. $N=$_POST['n'];

    echo "The no. is: ".$N;
    echo "
    ";

    $flag=1;

    for($i=2;$i<=$N/2;$i++)
    {
    if($N%$i==0)
    {
    echo "$N is not prime";
    exit(0);
    }
    }
    if($flag==1)
    echo "$N is prime number";

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. php
    $nos=$_POST["no"];
    $f=0;
    for($i=2;$i<=$nos/2;$i++)
    {
    if($nos%$i==0)
    {
    $f=1;
    break;
    }
    }
    if($f==1)
    {
    echo"$nos is not prime";

    }
    else
    {
    echo"$nos is prime";
    }
    ?>

    ReplyDelete