Tugas algoritma 4

Pertemuan 22 Oktober 2015

Repetition

-Repetition is One or more instruction that is repeatedĀ for a certain amount of time.

-Number of repetition can be predefined(hard-coded) or defined at run-time.

-Operation:

  • for
  • while
  • do-while

Repetition:FOR

for{exp1;exp2;exp3}statement;

Infinite loop:Stop with break.

Nested loop:Loop within a loop.

Repetition While

Hanya berjalan bila statement true.

Repetition:Do-While:

Melakukan proses dulu lalu memeriksa statement.

Repetition Operation:

Break untuk memaksa menutup proses.

Leave a Reply

Your email address will not be published. Required fields are marked *