How do I find the products of all two-digit numbers?

  • 0
    How can you enter the product of all two-digit numbers into an array? For example: 10 * 10, 10 * 11, etc. At least the logic, I will write the code myself.
    JavaScript Anonymous, Nov 22, 2019

  • 3 Answers
  • 0
    Logic:

    Double nested loop from 10 to 99 each
    Anonymous

  • 0
    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <input id="x1"><br>
    <input id="x2">
    <button onclick="obr()">add</button>
    </body>
    <script type="text/javascript">
    var arr = [];
    function obr(){
    var x1 = document.getElementById("x1").value;
    var x2 = document.getElementById("x2").value;
    arr.push(x1*x2);
    console.log(arr)
    }
    </script>
    </html>
    Anonymous

  • 0
    We calculate the main diagonal (10 elements) and fill in the environment.

    Just one single cycle of 10 iterations.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!