public void EvenOdd()
{
int countEven = 0;
int countOdd = 0;
int sumOfEven = 0;
int sumOfOdd = 0;
Console.WriteLine("insert a number");
char[] nums = Console.ReadLine().ToCharArray();
for (int i = 0; i < nums.Length; i++)
{
if (int.Parse(nums[i].ToString()) % 2 == 0)
{
countEven++;
sumOfEven = sumOfEven + int.Parse(nums[i].ToString());
}
else
{
countOdd++;
sumOfOdd = sumOfOdd + int.Parse(nums[i].ToString());
}
}
Console.WriteLine($"{countEven} even numbers \n{countOdd} odd numbers \n {sumOfEven} sum of even \n {sumOfOdd} sum of odd");
Console.WriteLine($"{countEven} \n {countOdd} \n {sumOfEven} \n {sumOfOdd}");
}
{
int countEven = 0;
int countOdd = 0;
int sumOfEven = 0;
int sumOfOdd = 0;
Console.WriteLine("insert a number");
char[] nums = Console.ReadLine().ToCharArray();
for (int i = 0; i < nums.Length; i++)
{
if (int.Parse(nums[i].ToString()) % 2 == 0)
{
countEven++;
sumOfEven = sumOfEven + int.Parse(nums[i].ToString());
}
else
{
countOdd++;
sumOfOdd = sumOfOdd + int.Parse(nums[i].ToString());
}
}
Console.WriteLine($"{countEven} even numbers \n{countOdd} odd numbers \n {sumOfEven} sum of even \n {sumOfOdd} sum of odd");
Console.WriteLine($"{countEven} \n {countOdd} \n {sumOfEven} \n {sumOfOdd}");
}