C

Loops in C (for, while, do-while)

Në shqip: Ciklet në C

ShpjegimiSQ

C-ja ka tre cikle: for kur e di sa herë (for (int i = 0; i < 10; i++)), while kur përsërit derisa një kusht bëhet false, dhe do-while që ekzekutohet të paktën një herë.

EnglishEN

C has three loops: for when you know how many times (for (int i = 0; i < 10; i++)), while to repeat until a condition becomes false, and do-while which runs at least once.

Si ta mendosh

Si xhirot rreth fushës: for = „bëj 10 xhiro“, while = „vrapo derisa të lodhesh“.

Lexoje në anglisht

Like laps around the pitch: for = “do 10 laps”, while = “run until you're tired”.

Shembull kodic

for (int i = 1; i <= 5; i++) printf("%d ", i);
int n = 10;
while (n > 0) n /= 2;

Terma të lidhur