Pripreme za JESENSKI ROK dostupne odmah!

-

Informatika - 2021./22. ljeto - 30.

30. Zadan je programski odsječak.
Python
C
$\begin{aligned} & \mathrm{s} = 40 \\ & \mathrm{x} = 3 \\ & \mathrm{i} = 0 \\ & \text{while i <= 3:} \\ & \qquad \begin{aligned} \mathrm{x} & = \mathrm{x} + 4 \\ \mathrm{s} & = \mathrm{s} - \mathrm{x} \\ \mathrm{x} & = \mathrm{x} + 4 \\ \mathrm{i} & = \mathrm{i} + 1 \end{aligned} \end{aligned}$
$\begin{aligned} & \text{int s, x, i;} \\ & \mathrm{s} = 40; \\ & \mathrm{x} = 3; \\ & \mathrm{i} = 0; \\ & \text{while (i <= 3)}\{ \\ & \qquad \mathrm{x} = \mathrm{x} + 4; \\ & \qquad \mathrm{s} = \mathrm{s} - \mathrm{x;} \\ & \qquad \mathrm{x} = \mathrm{x} + 4; \\ & \qquad \mathrm{i} = \mathrm{i} + 1; \\ & \} \end{aligned}$
A. Koja će biti vrijednost varijable $\mathbf{x}$ nakon izvođenja zadanoga programskog odsječka?
B. Koja će biti vrijednost varijable $\mathbf{s}$ nakon izvođenja zadanoga programskog odsječka?
ŠTO ČEKAŠ?

Isprobaj potpuno besplatno!

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

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