No result found.

Outline

  • Counting Even and Odd Numbers

Even and Odd Numbers (PHP)

Varun Chouhan07 Apr, 2020

Counting Even and Odd Numbers

        <!DOCTYPE html>
<head>  
      <title> Even $ odd </title>
</head>
<body>
       <Form action=""Method="Post">
     form<input type ="text" name ="form">
      to:<input type="Text name="OK">

    <input type ="Sumit" name="OK">
    </form>
    </body>
    </html>
    <?PHP
          if isset [$post ("OK])){
          $form=$post["form");
          $to=$post("To");
          $eve=0;
          $odd=0;
          $Temp=0;
          if($form>$to)
          {
             $temp=0;
          if($form>$to)
          {
           $temp=$form;
           $form=$to;
           $to= $temp;
          }
           for($i=$from; $i<=$to; i++){
              if ($ 1%2 ==0)
                  $ even ++;
               else
                    $odd ++i;
          }
           echo "even $ even odd $ odd");
     }
?>