fork(6) 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 = 0; i/2 < A.Length; i+=2)
  10. {
  11. B[i] = A[i / 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.03s 33736KB
stdin
Standard input is empty
stdout
Index: 0 Value: A
Index: 1 Value: 
Index: 2 Value: B
Index: 3 Value: 
Index: 4 Value: C
Index: 5 Value: 
Index: 6 Value: D
Index: 7 Value: 
Index: 8 Value: 
Index: 9 Value: