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 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);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us