Informatika - 2021./22. ljeto - 32.

32. Zadan je program.
Python
C
$\begin{aligned} & \mathrm{a} = \text{int(input())} \\ & \mathrm{b} = \text{int(input())} \\ & \mathrm{c} = \text{int(input())} \\ & \text{if c > a and a > b:} \\ & \qquad \begin{aligned} \mathrm{a} & = \mathrm{c} \\ \mathrm{b} & = \mathrm{a} + \mathrm{b} \end{aligned} \\ & \text{elif b > a or a > c:} \\ & \qquad \begin{aligned} \mathrm{b} & = \mathrm{c} \\ \mathrm{a} & = \mathrm{b} + \mathrm{c} \end{aligned} \\ & \text{else:} \\ & \qquad \begin{aligned} \mathrm{a} & = \mathrm{b} \\ \mathrm{b} & = \mathrm{c} + \mathrm{b} \end{aligned} \\ & \text{print(a, b, c)} \end{aligned}$
$\begin{aligned} & \text{int a, b, c;} \\ & \text{scanf("\%d", \&a);} \\ & \text{scanf("\%d", \&b);} \\ & \text{scanf("\%d", \&c);} \\ & \text{if (c > a \&\& a > b)}\{ \\ & \qquad \mathrm{a} = \mathrm{c;} \\ & \qquad \mathrm{b} = \mathrm{a} + \mathrm{b;} \\ & \} \\ & \text{else if (b > a || a > c)}\{ \\ & \qquad \mathrm{b} = \mathrm{c;} \\ & \qquad \mathrm{a} = \mathrm{b} + \mathrm{c;} \\ & \} \\ & \text{else}\{ \\ & \qquad \mathrm{a} = \mathrm{b;} \\ & \qquad \mathrm{b} = \mathrm{c} + \mathrm{b;} \\ & \} \\ & \text{printf("\%d \%d \%d", a, b, c);} \end{aligned}$
A. Što će ispisati program ako se za a, b i c upišu vrijednosti 5, 4, 6?
B. Što će ispisati program ako se za a, b i c upišu vrijednosti 7, 7, 9?
ŠTO ČEKAŠ?

Isprobaj potpuno besplatno!

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

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