Check out example codes for "sum of two numbers in c#". It will help you in understanding the concepts better.

Code Example 1

int num = 123;
int sum = 0;
while(num > 0)
{
  sum += number % 10;
  num /= 10;
}
Console.WriteLine(sum); // output: 6

Learn ReactJs, React Native from akashmittal.com