4225 - Ad Cif

From Bitnami MediaWiki
Revision as of 11:26, 1 April 2023 by Pop Giulia (talk | contribs) (Pagină nouă: n = int(input()) s = 0 max_dreapta = -1 while n > 0: cifra = n % 10 if cifra > max_dreapta: s += cifra max_dreapta = cifra n //= 10 print(s))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

n = int(input()) s = 0 max_dreapta = -1

while n > 0:

   cifra = n % 10
   if cifra > max_dreapta:
       s += cifra
       max_dreapta = cifra
   n //= 10

print(s)