A
UBB · Informatică
109

Se consideră algoritmul algo(n), unde n este un număr natural (1n1051 \le n \le 10^5).

Algoritm 1

Algorithm algo(n)
  a ← 0; b ← False
  While n > 0 execute
    c ← n MOD 10
    If c MOD 2 = 0 then
      a ← a + c; b ← True
    EndIf
    n ← n DIV 10
  EndWhile
  If NOT b then Return −1
  Else Return a EndIf
EndAlgorithm

Ce va returna apelul algo(6356)?

43 / 60