Repetition
Hhhaii gayiss!!! cause I'm in a good term I wanna write a summary that i've studied from BINA NUSANTARA UNIVERSITY . So without further ado let's check it out.
--> repetition
looping and iteration are the other term of repetition. repetition itself seperti
beberapa pengulangan yang ditentukan.
repetition/iteration/looping exist three ways: for,while,do-while.
Before we start we have need, "inisialisasi awal" to "kondisi awal pengulangan dan menghentikan proses looping"
repetition syntax
for(nilai awal;tes kondisi nilai; operasi perubahan nilai)
{
kondisi yang akan dijalankan jika kondisi true;
}
example:
int i;
int x=5;
for(i=0;i<x;i++)
{
printf("%d",(i++1));
} //silahkan coba di compiler anda masing2 xixi
while
it is repeats a statement during a given condition is true. it will be
tests condition first then it will do the execution.
Example
:
int counter=0;
do {
printf( "%d ", counter );
++counter;
} while (counter <= 10);
I think that's all I can share with u guys if there's any mistake
please dont mind it.
Tidak ada komentar:
Posting Komentar