Algorithms / Cycles - Rewrite algorithm using cycles cycles 1-n

0

I am doing algorithm I exercises and I have a doubt about the statement that asks to do cycles 1-n.

The statement is: Rewrite algorithms MI-16 to MI-18, using cycles 1-n

And the MI-16 to MI-18 are the following:

MI-16: Enter and report values, as long as the value entered is not negative. Inform the amount of values entered.

MI-18: Given an M value, determine and issue a list with the first M multiples of 3 that are not 5, within the set of natural numbers

What would a 1-n cycle be?

    
asked by jqc 05.12.2017 в 15:39
source

1 answer

2

It is simply a cycle that is executed the first time and that depending on what happens inside it, it can be executed n number of times until something happens that ends it.

EXAMPLE

It will show a window once and if you enter a letter it will print on the screen, then it will show the window again and if you enter another letter it will print it too, then the window will come back out and if you enter a number it will fail and it will leave the cycle If you never enter a number, it will be executed n number of times that the data is entered correctly. but it was fulfilled that it was executed the first time.

    
answered by 05.12.2017 / 16:11
source