Помощ за Odd / Even Position от Programmings Basics with C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication9
{
class Program
{
static void Main(string[] args)
{
var n = int.Parse(Console.ReadLine());
var oddsum = 0;
var oddmin = double.MaxValue;
var oddmax = double.MinValue;
var evensum = 0;
var evenmin = double.MaxValue;
var evenmax = double.MinValue;
var br1 = 0;
var br2 = 0;
var br3 = 0;
var br4 = 0;
for (int i = 1; i <= n; i++)
{
var element = int.Parse(Console.ReadLine());
if (i % 2 == 0) evensum = evensum + element;
else oddsum = oddsum + element;
if (element > oddmax) oddmax = element;
else br1++;
if (oddmin > element) oddmin = element;
else br2++;
if (element > evenmax) evenmax = element;
else br3++;
if (evenmin > element) evenmin = element;
else br4++;
}
Console.WriteLine("oddsum "+oddsum);
if (br1 == n) Console.WriteLine("No");
else Console.WriteLine("oddmin "+oddmin);
if (br2 == n) Console.WriteLine("No");
else Console.WriteLine("oddmax "+oddmax);
Console.WriteLine("evensum "+evensum);
if (br3 == n) Console.WriteLine("No");
else Console.WriteLine("evenmin "+evenmin);
if (br4 == n) Console.WriteLine("No");
else Console.WriteLine("evenmax "+evenmax);
}
}
}
Опитвам се по мой начин да реша задачата, но вече 8 пъти я пуснах в джъджа и все 0 точки.