thia_88 wrote:My Assignment Question : Assign a Random Value to each cells(array table), the value must be able to be divided by 5 (multiple of 5) and in between 100 to 2000.
Aside from what Billy has already said; I am being an optimist here
What is the required length of this array table/cell; meaning, how many random numbers/multiples of 5 are to be generated in one single run of the program or are these tables to be used for something else? (because we are talking cells/array tables)
A beginner level method to achieve the requisite <if I have understood the requirement, even a bit; minus the cell part>, can be by writing an algorithm similar to that of a multiplication table.
Difference here being, the formula will look something as: X * 5; where X will be a randomly generated number between your range of values.
You can accept the value of a number via user input, have an IF condition to check whether this input number is in the requisite range you need; IF yes, then proceed to randomize it using this as a SEED VALUE (the arguement
value) for RANDOM function; assign this value to X; have a conditional check on this randomly generated value, as to whether this is within your requisite range, IF yes, proceed on to multiply/divide/do the remaining requisite operations with this randomly generated number.
If it is an array of values you need; then it gets a little more complicated as you might've to add a PERFORM VARYING loop, which would take the newly generated RANDOM value as a new SEED VALUE and proceed with RANDOMizing it.
<All this, if I understood the requirement correctly; and yes, it is a bad design with all those IFs, but it is an absolute beginner logic; have a look at multiplication table generation logic, the algorithm for this requirement might be very similar to that>