Ad
Code
Diff
  • def SumDigitsOf(integer):
        return sum([int(value) for value in str(integer)])
    • using System;
    • using System.Linq;
    • using System.Collections.Generic;
    • namespace Kumite
    • {
    • public class Problem
    • {
    • public static int SumDigitsOf(long integer) => (int)(from ch in integer.ToString()
    • where Char.IsDigit(ch)
    • select Char.GetNumericValue(ch)).Sum();
    • }
    • }
    • def SumDigitsOf(integer):
    • return sum([int(value) for value in str(integer)])