Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLight
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[] numbers = { 1, 2, 3, 4, 5 };
- Console.WriteLine("Числа в массиве:");
- for (int i = 0; i < numbers.Length; i++)
- {
- Console.Write(numbers[i] + " ");
- }
- Console.WriteLine("\nНа сколько сдвинуть массив?");
- int shift = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < shift; i++)
- {
- int tempNumber = numbers[0];
- for (int j = 0; j < numbers.Length - 1; j++)
- {
- numbers[j] = numbers[j + 1];
- }
- numbers[numbers.Length - 1] = tempNumber;
- }
- Console.WriteLine("Сдвинутый массив");
- for (int i = 0; i < numbers.Length; i++)
- {
- Console.Write(numbers[i] + " ");
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement