int[] array = new int[n]; ////pre-rotation of array method: //-----------------------------------Right rotation //for (int i = 0; i < n; i++) //{ // array[(i + k) % n] = int.Parse(s[i]); //} //------------------------------------Left rotation for (int i = 0; i < n; i++) { array[(i + (n-k)) % n] = int.Parse(s[i]); } for (int i = 0; i < n; i++) { Console.WriteLine(array[i]+" "); }