Advertisement
Guest User

Untitled

a guest
Feb 8th, 2015
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. int a = 1;
  2.             int b = 3;
  3.             int c = -4;
  4.             int d = -2;
  5.             int e = -1;
  6.  
  7.             int[] arr = { a, b, c, d, e };
  8.  
  9.           //  Console.WriteLine(arr.Length);
  10.             for (int i=0; i<=arr.Length-1; i++)
  11.             {
  12.             if (arr[0] + arr[i+1] == 0)
  13.                 {
  14.  
  15.                     if (arr[i+1] >= arr[arr.Length-1])
  16.                     {
  17.                        // arr[i + 1] = arr[arr.Length - 1];
  18.                         break;
  19.                     }
  20.                     Console.WriteLine("{0} + {1} = 0", arr[0], arr[i + 1]);
  21.                 }
  22.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement