Horje
sum in c# Code Example
sum of two numbers in c#
int num = 123;
int sum = 0;
while(num > 0)
{
  sum += number % 10;
  num /= 10;
}
Console.WriteLine(sum); // output: 6
sum in c#
int[] arr = new int[] { 1, 2, 3 };
int sum = 0;
for (int i = 0; i < arr.Length; i++)
{
    sum += arr[i];
}

int[] arr = { 3, 6, 4, 1, 6, 8 };

// returns 1
Array.IndexOf(arr, 6);

int maxValue = anArray.Max();
int maxIndex = anArray.ToList().IndexOf(maxValue);




Csharp

Related
unique items in list c# Code Example unique items in list c# Code Example
how to save datagridview data to database in c# windows application Code Example how to save datagridview data to database in c# windows application Code Example
C# that creates an integer array and displays the sum of all its element values. Code Example C# that creates an integer array and displays the sum of all its element values. Code Example
add mime type for woff in web.config Code Example add mime type for woff in web.config Code Example
use a for loop to sum an array c# Code Example use a for loop to sum an array c# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11