public static void Main()
int[] arr = { 1, 2, 3, 4, 5 };
rightShiftArray(ref arr, 2);
Console.WriteLine(string.Join(",", arr));
public static void rightShiftArray(ref int[] arr, int shift)
for (int i = 0; i < shift; i++)
for (int j = 0; j < arr.Length - 1; j++)
arr[j] = arr[arr.Length - 1];
arr[arr.Length - 1] = temp;