Jump to content

Algoritmi: Structura Repetitiva


Recommended Posts

Prin aceasta structura se exectuta repetat o actiune sau o secventa de actiuni,atat timp cat conditia precizata este adevarata.

Executarea repetata a unei actiuni este un concept algoritmic foarte important.Metoda de implementare este structura repetitiva(=interativa) cunoscuta sub numele de ciclu sau bucla (loop) in care corpul ciclului (=iteratie) se executa repetat sub un porces de control :

testeaza conditie

executa corpul ciclului

testeaza conditie

executa corpul ciclului


testeaza conditie pana cand conditia nu mai este indeplinita

Procesul de control cuprinde 3 actiuni:

  • Initializarea
  • Testarea
  • Modificarea


s <-- 0 (citeste a)

s <-- 0 si i <-- 1

TESTAREA:Compara starea curenta cu starea finala.Daca cele doua sunt egale,procesul se termina.

1.Se compara a cu 0 ( a<>0 ) --> se repeta atat timp cat operatorul furnineaza valoarea "adevarat"

2.Procesul de executare repetata se termina cand a=0

MODIFICAREA:Schimba starea curenta --> starea finala.Aceasta actiune face parte din corpul ciclului.

4Qn7oKL.gif cjZhNAh.gifsykL3n4.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.