Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Problem 5 SingleDigit
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { int n=0; n=Convert.ToInt32(Console.ReadLine()); Sum obj = new Sum(); int digitsum = obj.sumRecursive(n); Console.Write(digitsum); } } class Sum { public int sumRecursive(int num) { int sum = sumDigits(num); if(sum < 10) { return sum; } sumRecursive(sum); } public int sumDigits(int num) { if (num != 0) { return (num % 10 + sum(num / 10)); } else { return 0; } } } }
run
|
edit
|
history
|
help
0
Eliminate duplicates char in string either upper or lower case
Date Diff
Found many section of times intersect (Question version)
ProbableCause
BTC sell estimator
test coeur
CODE
V
Practicando C#
Planet-D ver. 0.5