Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
sum 2
//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 num, result; pro pg = new pro(); Console.WriteLine("Enter the Number : "); num=int.Parse(Console.ReadLine()); result =pg.sum(num); Console.WriteLine("Sum of Digits in {0} is {1}", num, result); Console.ReadLine(); } } class pro { public int sum(int num) { if (num != 0) { return (num % 10 + sum(num / 10)); } else { return 0; } } } }
run
|
edit
|
history
|
help
0
amstrong number
pyramidalt
n th to last element
test
5
Operator Overloading Example (+, -, *, /, ==, !=)
csharp enum
масиви част1
dsadsadsa
FixConsectiveDuplicates