121 Raspunsuri multiple
Se consideră algoritmul Cifra(n), unde n este un număr natural (). frec este un șir de 10 elemente, inițializate cu 0.
Algoritm 1
Algorithm Cifra(n)
temp ← n
While temp > 0 execute
cifra ← temp MOD 10
frec[cifra] ← frec[cifra] + 1
If frec[cifra] > 1 then Return 0 EndIf
temp ← temp DIV 10
EndWhile
s ← Check(n)
If s = n then Return 1 EndIf
While s > 9 execute
aux ← s; s ← 0
While aux > 0 execute
s ← s + aux MOD 10
aux ← aux DIV 10
EndWhile
EndWhile
Return s
EndAlgorithmAlgoritm 2
Algorithm Check(x)
s ← 0
For d ← 1, √x execute
If x MOD d = 0 then
s ← s + d
If d*d ≠ x then s ← s + x DIV d EndIf
EndIf
EndFor
Return s
EndAlgorithmCare dintre următoarele afirmații sunt adevărate?
55 / 60