Browse Source

Create index.cs

indexRownowagi
MateushK 5 years ago
parent
commit
8bcbb96270
  1. 46
      indexRownowagi/index.cs

46
indexRownowagi/index.cs

@ -0,0 +1,46 @@
using System;
public class Program
{
public static void Main()
{
int[] A = {-7, 1, 5, 2, -4, 3, 0};
int length = A.Length;
int sum1=0, sum2=0;
if(A.Length < 3)
{
System.Console.Write("-1");
}
else
{
for(int i = 1; i<length; i++)
{
for(int j=0; j<length; j++)
{
System.Console.Write("j:"+j+" "+"i:"+i+" ");
if(A[j] < A[i])
{
sum1 +=A[j];
}
if(A[j] > A[i] && A[j]<length)
{
sum2 +=A[j];
}
}
if(sum1 ==sum2)
{
System.Console.Write(i);
break;
}
}
}
}
}
Loading…
Cancel
Save