A
UBB · Informatică
153

Se consideră algoritmul g(x), unde x este un număr natural nenul (1x1051 \le x \le 10^5).

Algoritm 1

Algorithm f(x)
  If x = 0 then
    Return 0
  Else
    Return (x MOD 10) + f(x DIV 10)
  EndIf
EndAlgorithm

Algoritm 2

Algorithm g(x)
  If x > 1 then
    Write f(x), " "
    g(x DIV 2)
    Write x + 3, " "
    g(x DIV 2)
  EndIf
EndAlgorithm

Ce se afișează în urma apelului g(10)?

3 / 37