Soren Winslow Soren Winslow
Get Dividing Numbers
Quick and easy utility to find all the numbers that will divide evenly into a number. This quick and simple utility may help in setting up large tables. For example if I know I will have 4096 table cells, I will find out quickly that I could have a table of 256 rows of 16 cells each. Good example of a For...Next loop and use of Mod.

Enter a number:

Here is the ASP code for this script:



  <form name="Divisor" method="post" action="<%=Request.ServerVariables("URL")%>">

  <div class="breg">

     Enter a number:

     <input type="text" name="TheNum" size="5" class="breg">

     <input type="submit" name="DoSomething" value="Get Dividing Numbers" class="breg">

  </div>

  </form>



 <div class="breg" style="text-align:left;padding-left:20px;">

 <%

   TheNum = Request("TheNum")

   If IsNumeric(TheNum) Then



     For x = 1 to TheNum



        If TheNum Mod x = 0 Then



           Response.Write TheNum & "/" & x & " = " & TheNum/x & "<br>"



        End If



     Next



   End If



 %>

 </div>





               
© 1967 - 2024 Soren Winslow