THAPA TECHNICAL

HOUSE OF WEB DEVELOPERS AND TECHNOLOGY.

PHP CHALLENGE BY THAPA TECHNICAL:

PHP CHALLENGE BY THAPA TECHNICAL


Q1:  Your challenge is to list all of the multiples of 12 which are less than or equal to 240.  You must complete this task twice, once using a While loop and once using a Do WHILE loop.   
The multiples of 12 are 12,24,36,48,60,72,84,96,108,120,132,144,156,168,180,192,204,216,228 and 240.

Your answer format should be 12 * 1 = 12,  12 * 2 = 24, 12 * 3 = 36 etc till 12 * 20 = 240.

ALL THE BEST. POST YOUR ANSWERS BELOW IN COMMENT BOX.

If you want some reference for it on how to do it. Feel free to watch my videos first on While loop, Do While Loop and For loop. Then I am 110% sure you can do it on your own. Here are the videos. You can directly watch it here only.


19 comments:

  1. Guys, Comment your answers here. I will check for sure :)

    ReplyDelete
  2. I'm Posting the right answer but it's not showing.

    ReplyDelete
    Replies
    1. Sorry for that just take the pic or screen shot and paste it :)

      Delete
  3. My code is not visible properly in your comment section brother so here is my code "https://phpcodeanswer.blogspot.com/2020/02/answer-for-while-loop-num-12-multiplier.html"

    ReplyDelete

  4. // using while loop
    ";
    $a++;
    }

    ?>
    // using do while loop
    ";
    $a++;
    }($a<=20);

    ?>

    ReplyDelete
  5. ";
    $i++;
    }while($i<=10);

    // while($i<=10){
    // echo $i. "
    ";
    // $i++;
    // }


    ?>

    ReplyDelete
  6. ";
    $i++;
    }


    // 2 Task Do While loop Sol.
    $x=12;
    $i=1;
    do {
    echo $x." * ".$i." = ".$x*$i."";
    $i++;
    }while($i<=20);


    // 2 Task For loop Sol.
    $x=12;
    for($i=1; $i<=20; $i++) {
    echo $x." * ".$i." = ".$x*$i."";
    }
    ?>

    ReplyDelete
    Replies
    1. ";
      $i++;
      }


      // 2 Task Do While loop Sol.
      $x=12;
      $i=1;
      do {
      echo $x." * ".$i." = ".$x*$i."";
      $i++;
      }while($i<=20);


      // 2 Task For loop Sol.
      $x=12;
      for($i=1; $i<=20; $i++) {
      echo $x." * ".$i." = ".$x*$i."";
      }
      ?>

      Delete
  7. //while loop

    ";
    }
    ?>

    //Do while loop

    ";
    }While($i<=20)
    ?>


    ReplyDelete
  8. ";
    $mult++;
    }
    $number++;
    }

    //With Do...While Loop
    do{
    if($number%12==0){
    echo "12*".$mult."=".($number*1);
    echo "
    ";
    $mult++;
    }
    $number++;
    }
    while($number<=240)

    //With For Loop
    for($number=1;$number<=240;$number++){
    if($number%12==0){
    echo "12*".$mult."=".($number*1);
    echo "
    ";
    $mult++;
    }
    }

    ?>

    ReplyDelete
  9. There is something wrong with comment section- It's not proper displaying!

    ReplyDelete