Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Homework3_8
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[] numbers = { 1, 2, 3, 4, 5 };
- int step = 0;
- int temp;
- int lastIndexArray = numbers.Length - 1;
- Console.Write("Масcив: 1, 2, 3, 4, 5");
- Console.Write("\nНа сколько позиций сдвинуть массив: ");
- step = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < step; i++)
- {
- temp = numbers[0];
- for (int j = 0; j < lastIndexArray; j++)
- {
- numbers[j] = numbers[j + 1];
- }
- numbers[lastIndexArray] = temp;
- }
- foreach (int number in numbers)
- {
- Console.Write(number + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement