using System;
namespace MyCompiler {
class Program {
public static void Main(string[] args) {
int[] inputArray = {40,50,60};
int copyTimes =2;
//int lastElement = inputArray.Length;
//int[] inputArray = Array.reverse(inputArrayReverse);
Reverse(inputArray, 0, inputArray.Length);
Console.WriteLine("Array elements reversed");
Console.WriteLine(String.Join(",",inputArray));
int countToRunArracy = inputArray.Length * (copyTimes-1);
Console.WriteLine("How many times {0}",countToRunArracy);
for(int i=0;i < countToRunArracy ; i++){
Array.Resize(ref inputArray, inputArray.Length+1);
Console.WriteLine("Array elements");
Console.WriteLine(String.Join(",",inputArray));
inputArray[inputArray.Length-1]=inputArray[i];
}
Console.WriteLine(String.Join(",",inputArray));
}
public void Reverse(int[] arr, int startIndex, int endIndex){
int temp =0;
while(startIndex < endIndex){
temp = arr[startIndex];
arr[startIndex] = arr[endIndex-1];
arr[endIndex-1] = temp;
startIndex++;
endIndex--;
}
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: