Introduction

Create an application that finds all the numbers between 1 and 1000 that have
the specified number as a divisor.

Algorithm

Dimension and initialize variables
For intCounter = 1 To 1000
If intCounter is evenly divisible by intDivisor Then
strResult = strResult & new number & ", "
End If
Next intCounter
Display results

Important features

  • For…Next in proper format
  • Mod operator
  • Count and Done buttons, with Default and Cancel properties set
  • Error control – if user leaves textbox empty or enters number not between 1 and 1000, displays error message
  • String accumulator used for compiling results
  • Frame caption is updated with results
  • Results messages are cleared when input changes
  • Proper indents, spacing, comments
  • Explanation paragraph (see below)

Example

      

Explanation

In addition to your program, write a paragraph explaining in common terms how the algorithm to count letters works. Make it clear that you understand the purpose of each variable, the loop and the test for divisors.

Extra credit

Replace the trailing comma that occurs as a side effect of the string accumulator code with a period to end the list.