Программа не видит переменные - C#
Формулировка задачи:
помогите пожалуйста, я возвращаю в методе maxIndex и mixIndex но в Main он их не видит, как правильно сделать?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(String[] args)
{
int[] c = { 3, 1, 10, 3, 2, 44, 3 };
double result = (c.Where((elem, index) => (minIndex < maxIndex) ? index > minIndex && index < maxIndex : index > maxIndex && index < minIndex)).Sum();
Console.WriteLine(result);
Console.ReadKey();
}
private static int GetMax(int[] c)
{
int maxIndex = Array.IndexOf(c, c.Max());
return maxIndex;
}
private static int GetMin(int[] c)
{
int minIndex = Array.IndexOf(c, c.Min());
return minIndex;
}
}
}Решение задачи: «Программа не видит переменные»
textual
Листинг программы
double result = (c.Where((elem, index) => (GetMin(c) < GetMax(c)) ? index > GetMin(c) && index < GetMax(c) : index > GetMax(c) && index < GetMin(c))).Sum();