Skip to main content
adicionou 30 caracteres ao conteúdo
Fonte Link
Jorge B.
  • 11,6mil
  • 7
  • 52
  • 98

fim=int(input("Digite o valor de n: ")) string = str(fim) soma = 0 for ch in string: if ch.isdigit(): soma += int(ch) print(soma)

fim=int(input("Digite o valor de n: "))
string = str(fim)
soma = 0
for ch in string:
    if ch.isdigit():
        soma += int(ch)
print(soma)    

fim=int(input("Digite o valor de n: ")) string = str(fim) soma = 0 for ch in string: if ch.isdigit(): soma += int(ch) print(soma)

fim=int(input("Digite o valor de n: "))
string = str(fim)
soma = 0
for ch in string:
    if ch.isdigit():
        soma += int(ch)
print(soma)    
Fonte Link

fim=int(input("Digite o valor de n: ")) string = str(fim) soma = 0 for ch in string: if ch.isdigit(): soma += int(ch) print(soma)