Pripreme za JESENSKI ROK dostupne odmah!

-

Informatika - 2023./24. ljeto - 11.

Koliko će se puta izvesti petlja u zadanome programu?
Pyhton
C
$\begin{aligned} & \mathrm{n}=25 \\ & \mathrm{i}=2 \\ & \mathrm{~s}=0 \\ & \mathrm{a}=0 \\ & \text { while n }!=0 \text { : } \\ & \qquad \begin{aligned} \mathrm{s} & =\mathrm{s}+\mathrm{n} \\ \mathrm{n} & =\mathrm{n}-\mathrm{i} \\ \mathrm{a} & =\mathrm{a}+1\end{aligned}\end{aligned}$
$ \begin{aligned} & \text{int } i, n, s, a; \\ & n = 25; \\ & i = 2; \\ & s = 0; \\ & a = 0; \\ & \text{while (n != 0) \{} \\ & \qquad \begin{aligned} & s = s + n; \\ & n = n - i; \\ & a = a + 1; \end{aligned} \\ & \text{\}} \end{aligned} $
ŠTO ČEKAŠ?

Isprobaj potpuno besplatno!

Registracijom dobivaš besplatan*
pristup dijelu lekcija za svaki predmet.

*Besplatan pristup ne zahtijeva unos kartice.
© 2025, Gradivo.hr