fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. // your code goes here
  9. int[] arr = {1,2,3,4,5};
  10. foreach (int i in Enumerable.Range(0, arr.Length - 1))
  11. {
  12. Console.WriteLine("i={0}, arr[i]={1}, arr[i+1]={2}", i, arr[i], arr[i + 1]);
  13. }
  14. }
  15. }
Success #stdin #stdout 0.03s 15456KB
stdin
Standard input is empty
stdout
i=0, arr[i]=1, arr[i+1]=2
i=1, arr[i]=2, arr[i+1]=3
i=2, arr[i]=3, arr[i+1]=4
i=3, arr[i]=4, arr[i+1]=5