fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. string[] A = new string[] { "A", "B", "C", "D" };
  8. string[] B = new string[A.Length * 2 + 2]; // you wanted to add something other as well
  9. for (int i = 1; (i-1) / 2 < A.Length; i += 2)
  10. {
  11. B[i] = A[(i-1) / 2];
  12. }
  13.  
  14. for(int i=0; i<B.Length;i++)
  15. Console.WriteLine("Index: {0} Value: {1}", i, B[i]);
  16. }
  17. }
Success #stdin #stdout 0.04s 33872KB
stdin
Standard input is empty
stdout
Index: 0 Value: 
Index: 1 Value: A
Index: 2 Value: 
Index: 3 Value: B
Index: 4 Value: 
Index: 5 Value: C
Index: 6 Value: 
Index: 7 Value: D
Index: 8 Value: 
Index: 9 Value: