sum of digits in c#
C#
int num = 123;
int sum = 0;
while(num > 0)
{
sum += number % 10;
num /= 10;
}
Console.WriteLine(sum); // output: 6
Also in C#:
- Title
- count number of enum values C#
- Category
- C#
- Title
- c# object to json string
- Category
- C#
- Title
- c# windows application get current path
- Category
- C#
- Title
- c# to vb.net
- Category
- C#
- Title
- C# loop through array of objet
- Category
- C#
- Title
- c# datafield change cell background color
- Category
- C#
- Title
- c# query string builder
- Category
- C#
- Title
- c# try catch error
- Category
- C#
- Title
- asp.net core redirecttoaction with parameters
- Category
- C#
- Title
- c# create new thread
- Category
- C#
- Title
- Assets/Scripts/Snake.cs(177,25): error CS1061: Type `Snake.SnakeBodyPart' does not contain a definition for `SetGridPostion' and no extension method `SetGridPostion' of type `Snake.SnakeBodyPart' could be found. Are you missing an assembly reference?
- Category
- C#
- Title
- exception handling c#
- Category
- C#
- Title
- how to make a for loop in c#
- Category
- C#
- Title
- find mongodb c# with task T
- Category
- C#
- Title
- visual c#
- Category
- C#
- Title
- http post request login example asp.net c#
- Category
- C#
- Title
- initialize matrix c#
- Category
- C#
- Title
- how to add an embedded resource in visual studio code
- Category
- C#
- Title
- windows forms iterate through all controls
- Category
- C#
- Title
- max of array C#
- Category
- C#
- Title
- how to edit a c# list
- Category
- C#
- Title
- c# storing value in session
- Category
- C#
- Title
- C# events
- Category
- C#
- Title
- .net core cli
- Category
- C#
- Title
- c# get motherboard id
- Category
- C#
- Title
- create a file in the directory of the exe and write to it c#
- Category
- C#
- Title
- parsing string to int without format exception c#
- Category
- C#
- Title
- c# date
- Category
- C#
- Title
- unity c# run a command then wait
- Category
- C#
- Title
- c# switch case with or condition
- Category
- C#
- Title
- how to access the dictionary from another script in unity
- Category
- C#
- Title
- bind repeater to dictionary
- Category
- C#
- Title
- c# get desktop path
- Category
- C#
- Title
- how to convert object in string JSON c#
- Category
- C#
- Title
- unity prevent system from creation
- Category
- C#
- Title
- How to set an expiry date on a program
- Category
- C#
- Title
- c# bitmap to array byte
- Category
- C#
- Title
- unity simple fps controller
- Category
- C#
- Title
- Check object is in layermask unity
- Category
- C#
- Title
- isdaylightsavingtime in c#
- Category
- C#
- Title
- c# check if argument null
- Category
- C#
- Title
- c# join array
- Category
- C#
- Title
- c# expression func automatically select return type
- Category
- C#
- Title
- optional parameter get request c#
- Category
- C#
- Title
- .net core copy file in folder to root
- Category
- C#
- Title
- how to set a gizmo color unity
- Category
- C#
- Title
- 2d character controller unity
- Category
- C#
- Title
- start a particle effect when a button is pushed
- Category
- C#
- Title
- unity position ui element
- Category
- C#
- Title
- button color uwp c#
- Category
- C#
- Title
- countdownevent
- Category
- C#
- Title
- .net core convert keycollection to array
- Category
- C#
- Title
- unity assign button onclick
- Category
- C#
- Title
- message uwp c#
- Category
- C#
- Title
- delay in unity
- Category
- C#
- Title
- convert string to double c#
- Category
- C#
- Title
- unity 3d mouse look script
- Category
- C#
- Title
- c# tostring mmm dd yyyy
- Category
- C#
- Title
- Category
- C#
- Title
- c# using get set methods
- Category
- C#
- Title
- c# reflection create generic type
- Category
- C#
- Title
- c sharp if string equals
- Category
- C#
- Title
- c# throw new exception
- Category
- C#
- Title
- c# md5 hash file
- Category
- C#
- Title
- c# console delay
- Category
- C#
- Title
- inheritance in c#
- Category
- C#
- Title
- c# keyvaluepair
- Category
- C#
- Title
- move character unity
- Category
- C#
- Title
- unity resources load
- Category
- C#
- Title
- convert number of days into months c#
- Category
- C#
- Title
- c# fileupload example
- Category
- C#
- Title
- c# object clone
- Category
- C#
- Title
- how to remove file changes in git
- Category
- C#
- Title
- iteration c#
- Category
- C#
- Title
- c# split a string and return list
- Category
- C#
- Title
- mvc input type file
- Category
- C#
- Title
- delegate function c#
- Category
- C#
- Title
- replace double backslash with single backslash c#
- Category
- C#
- Title
- unity set sprite transparency
- Category
- C#
- Title
- C# assigning image location
- Category
- C#
- Title
- how to convert string to bool c#
- Category
- C#
- Title
- start up file in asp.net core
- Category
- C#
- Title
- Instantiate c#
- Category
- C#
- Title
- c# find duplicates in list
- Category
- C#
- Title
- how to put double quotes in a string c#
- Category
- C#
- Title
- json ignore property c#
- Category
- C#
- Title
- perlin noise unity
- Category
- C#
- Title
- c# md5 string
- Category
- C#
- Title
- c# get pc ip address
- Category
- C#
- Title
- unity draw wire square
- Category
- C#
- Title
- c# httpclient postasync stringcontent
- Category
- C#
- Title
- Assets\playermove.cs(30,37): error CS1003: Syntax error, ',' expected
- Category
- C#
- Title
- c# stringbuilder
- Category
- C#
- Title
- split string in c#
- Category
- C#
- Title
- c# append array
- Category
- C#
- Title
- how to reduce garbage collection c#
- Category
- C#
- Title
- embed video to exe file with c#
- Category
- C#
- Title
- blazor display validation message
- Category
- C#
- Title
- how to add system.messaging c#
- Category
- C#
- Title
- mysql C# select pk and all columns datareader
- Category
- C#