October 17, 2018

Program Control - Repetition

For
//for(case1; case2; case3) statements;

For used when we want to do looping for a certain number of times.
don't forget to check the case because if we don't check the case, the program can be run with invinite looping.

Hasil gambar untuk for in c




While
//while(case)statements;

While used to check the command whether it's true or false.
the program will execute until the command is false.

Do-While
//do{statements;}while

This repetition is the combination of do and while. This repetition will check the validation before running until the condition is false.

Hasil gambar untuk while in c

Break
//break;

break is used to stop or end the loop.
Hasil gambar untuk do while in c
Continue
//continue;

continue is used to skip some statements when the statement is matches with the condition that was set in the beginning.

Hasil gambar untuk continue in c


Garvin Moses Tanuwihardjo - Binusian'22

No comments:

Post a Comment

Searching and Sorting in C Programming

Searching This is the process by which one searches the group of elements for the desired element. F or example: Binary Search In...